This demo shows Envoy running with Rotor as its xDS server. Consul is also running with two services, which Rotor discovers, and sends to Envoy as clusters.
To run the demo, use:
$ docker-compose up
in this directory to build and run the docker-compose.yaml
.
Rotor, Envoy, and Consul should start up. The Envoy admin console shows configuration and log information for Envoy and the configuration from Rotor.
You can either visit /clusters on the Envoy admin console to see the Consul servcies horse.turbinelabs.io and cow.turbinelabs.io are loaded, or curl:
$ curl localhost:9999/clusters
You can also view the Consul web UI.
Rotor creates a listener at localhost:80 for Envoy's clusters.
Try:
$ curl -H "Host:cow.turbinelabs.io" localhost:80
or
curl -H "Host:horse.turbinelabs.io" localhost:80
to see the results.
This example registers two domains in Consul as service instances:
horse.turbinelabs.io and cow.turbinelabs.io. Normally, your service instances
would be registered as IP addresses, not hostname. To handle this case, Rotor
can take the flag ENV ROTOR_XDS_RESOLVE_DNS=true
, and it will resolve DNS
before passing the instance IPs to Envoy. If you plan to use Envoy to route to
hostname, make sure to set this flag.