Getting Started

This section gets you started with a very simple configuration and provides some example configurations.

The fastest way to get started using Envoy is installing pre-built binaries. You can also build it from source.

These examples use the v2 Envoy API, but use only the static configuration feature of the API, which is most useful for simple requirements. For more complex requirements Dynamic Configuration is supported.

Quick Start to Run Simple Example

These instructions run from files in the Envoy repo. The sections below give a more detailed explanation of the configuration file and execution steps for the same configuration.

A very minimal Envoy configuration that can be used to validate basic plain HTTP proxying is available in configs/google_com_proxy.v2.yaml. This is not intended to represent a realistic Envoy deployment:

  1. $ docker pull envoyproxy/envoy:v1.14.0
  2. $ docker run --rm -d -p 10000:10000 envoyproxy/envoy:v1.14.0
  3. $ curl -v localhost:10000

The Docker image used will contain the latest version of Envoy and a basic Envoy configuration. This basic configuration tells Envoy to route incoming requests to *.google.com.

Simple Configuration

Envoy can be configured using a single YAML file passed in as an argument on the command line.

The admin message is required to configure the administration server. The address key specifies the listening address which in this case is simply 0.0.0.0:9901.

  1. admin:
  2. access_log_path: /tmp/admin_access.log
  3. address:
  4. socket_address: { address: 0.0.0.0, port_value: 9901 }

The static_resources contains everything that is configured statically when Envoy starts, as opposed to the means of configuring resources dynamically when Envoy is running. The v2 API Overview describes this.

  1. static_resources:

The specification of the listeners.

  1. listeners:
  2. - name: listener_0
  3. address:
  4. socket_address: { address: 0.0.0.0, port_value: 10000 }
  5. filter_chains:
  6. - filters:
  7. - name: envoy.filters.network.http_connection_manager
  8. typed_config:
  9. "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
  10. stat_prefix: ingress_http
  11. codec_type: AUTO
  12. route_config:
  13. name: local_route
  14. virtual_hosts:
  15. - name: local_service
  16. domains: ["*"]
  17. routes:
  18. - match: { prefix: "/" }
  19. route: { host_rewrite: www.google.com, cluster: service_google }
  20. http_filters:
  21. - name: envoy.filters.http.router

The specification of the clusters.

  1. clusters:
  2. - name: service_google
  3. connect_timeout: 0.25s
  4. type: LOGICAL_DNS
  5. # Comment out the following line to test on v6 networks
  6. dns_lookup_family: V4_ONLY
  7. lb_policy: ROUND_ROBIN
  8. load_assignment:
  9. cluster_name: service_google
  10. endpoints:
  11. - lb_endpoints:
  12. - endpoint:
  13. address:
  14. socket_address:
  15. address: www.google.com
  16. port_value: 443
  17. transport_socket:
  18. name: envoy.transport_sockets.tls
  19. typed_config:
  20. "@type": type.googleapis.com/envoy.api.v2.auth.UpstreamTlsContext
  21. sni: www.google.com

Using the Envoy Docker Image

Create a simple Dockerfile to execute Envoy, which assumes that envoy.yaml (described above) is in your local directory. You can refer to the Command line options.

  1. FROM envoyproxy/envoy:v1.14.0
  2. COPY envoy.yaml /etc/envoy/envoy.yaml

Build the Docker image that runs your configuration using:

  1. $ docker build -t envoy:v1 .

And now you can execute it with:

  1. $ docker run -d --name envoy -p 9901:9901 -p 10000:10000 envoy:v1

And finally, test it using:

  1. $ curl -v localhost:10000

If you would like to use Envoy with docker-compose you can overwrite the provided configuration file by using a volume.

Sandboxes

We’ve created a number of sandboxes using Docker Compose that set up different environments to test out Envoy’s features and show sample configurations. As we gauge peoples’ interests we will add more sandboxes demonstrating different features. The following sandboxes are available:

Other use cases

In addition to the proxy itself, Envoy is also bundled as part of several open source distributions that target specific use cases.