2019-10-05 11:45:45 +01:00
|
|
|
# traffic
|
|
|
|
|
|
|
|
|
|
## Name
|
|
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
*traffic* - handout addresses according to assignments from Envoy's xDS.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
The *traffic* plugin is a balancer that allows traffic steering, weighted responses
|
|
|
|
|
and draining of clusters. The cluster information is retrieved from a service
|
|
|
|
|
discovery manager that implements the service discovery protocols that Envoy
|
|
|
|
|
[implements](https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol).
|
2020-01-11 08:48:30 +01:00
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
A Cluster is defined as: "A cluster is a group of logically similar endpoints that Envoy connects
|
|
|
|
|
to. Each cluster has a name, which *traffic* extends to be a domain name.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
The use case for this plugin is when a cluster has endpoints running in multiple
|
|
|
|
|
(Kubernetes?) clusters and you need to steer traffic to (or away) from these endpoints, i.e.
|
|
|
|
|
endpoint A needs to be upgraded, so all traffic to it is drained. Or the entire Kubernetes needs to
|
|
|
|
|
upgraded, and *all* endpoints need to be drained from it.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
*Traffic* discovers the endpoints via Envoy's xDS protocol. Endpoints and clusters are discovered
|
|
|
|
|
every 10 seconds. The plugin hands out responses that adhere to these assignments. Each DNS response
|
|
|
|
|
contains a single IP address that's considered the best one. *Traffic* will load balance A and AAAA
|
|
|
|
|
queries. The TTL on these answer is set to 5s.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
|
|
|
|
The *traffic* plugin has no notion of draining, drop overload and anything that advanced, *it just
|
2020-01-10 09:52:29 +01:00
|
|
|
acts upon assignments*. This is means that if a endpoint goes down and *traffic* has not seen a new
|
|
|
|
|
assignment yet, it will still include this endpoint address in responses.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
|
|
|
|
## Syntax
|
|
|
|
|
|
|
|
|
|
~~~
|
|
|
|
|
traffic
|
|
|
|
|
~~~
|
|
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
The extended syntax (not implemented; everything is hard-coded at the moment):
|
2020-01-13 11:21:20 +01:00
|
|
|
|
|
|
|
|
~~~
|
|
|
|
|
traffic {
|
|
|
|
|
server grpc://dsdsd <creds>
|
2020-01-16 07:15:09 +01:00
|
|
|
node ID
|
2020-01-13 11:21:20 +01:00
|
|
|
}
|
|
|
|
|
~~~
|
|
|
|
|
|
2020-01-16 07:15:09 +01:00
|
|
|
* node **ID** is how *traffic* identifies itself to the control plane. This defaults to `coredns`.
|
2020-01-13 11:21:20 +01:00
|
|
|
|
2019-10-05 11:45:45 +01:00
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
|
|
~~~ corefile
|
|
|
|
|
example.org {
|
|
|
|
|
traffic
|
2020-01-15 20:33:53 +01:00
|
|
|
debug
|
|
|
|
|
log
|
2019-10-05 11:45:45 +01:00
|
|
|
}
|
|
|
|
|
~~~
|
|
|
|
|
|
|
|
|
|
This will add load balancing for domains under example.org; the upstream information comes from
|
|
|
|
|
10.12.13.14; depending on received assignments, replies will be let through as-is or are load balanced.
|
|
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
## Bugs
|
2019-10-05 11:45:45 +01:00
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
Priority from ClusterLoadAssignments is not used. Locality is also not used. Health status of the
|
|
|
|
|
endpoints is ignore (for now).
|
2020-01-11 08:48:30 +01:00
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
Load reporting via xDS is not supported; this can be implemented, but there are some things that make
|
2020-01-11 08:48:30 +01:00
|
|
|
this difficult. A single (DNS) query is done by a resolver. Behind this resolver there may be many
|
2020-01-15 20:33:53 +01:00
|
|
|
clients that will use this reply, the responding server (CoreDNS) has no idea how many clients use
|
|
|
|
|
this resolver. So reporting a load of +1 on the CoreDNS side can be anything from 1 to 1000+, making
|
|
|
|
|
the load reporting highly inaccurate.
|
2019-10-05 11:45:45 +01:00
|
|
|
|
|
|
|
|
## Also See
|
|
|
|
|
|
2020-01-15 20:33:53 +01:00
|
|
|
The following documents provide some background on Envoy's control plane.
|
|
|
|
|
|
2020-01-10 09:52:29 +01:00
|
|
|
* https://github.com/envoyproxy/go-control-plane
|
|
|
|
|
* https://blog.christianposta.com/envoy/guidance-for-building-a-control-plane-to-manage-envoy-proxy-based-infrastructure/
|
|
|
|
|
* https://github.com/envoyproxy/envoy/blob/442f9fcf21a5f091cec3fe9913ff309e02288659/api/envoy/api/v2/discovery.proto#L63
|