Configuration: Static

To start Envoy with static configuration, you will need to specify listeners and clusters as static_resources.

You can also add an admin section if you wish to monitor Envoy or retrieve stats.

The following sections walk through the static configuration provided in the demo configuration file used as the default in the Envoy Docker container.

static_resources

The static_resources contain everything that is configured statically when Envoy starts, as opposed to dynamically at runtime.

  1. static_resources:
  2. listeners:

listeners

The example configures a listener on port 10000.

All paths are matched and routed to the service_envoyproxy_io cluster.

  1. static_resources:
  2. listeners:
  3. - name: listener_0
  4. address:
  5. socket_address:
  6. address: 0.0.0.0
  7. port_value: 10000
  8. filter_chains:
  9. - filters:
  10. - name: envoy.filters.network.http_connection_manager
  11. typed_config:
  12. "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
  13. stat_prefix: ingress_http
  14. access_log:
  15. - name: envoy.access_loggers.stdout
  16. typed_config:
  17. "@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
  18. http_filters:
  19. - name: envoy.filters.http.router
  20. route_config:
  21. name: local_route
  22. virtual_hosts:
  23. - name: local_service
  24. domains: ["*"]
  25. routes:
  26. - match:
  27. prefix: "/"
  28. route:
  29. host_rewrite_literal: www.envoyproxy.io
  30. cluster: service_envoyproxy_io
  31. clusters:
  32. - name: service_envoyproxy_io

clusters

The service_envoyproxy_io cluster proxies over TLS to https://www.envoyproxy.io.

  1. route:
  2. host_rewrite_literal: www.envoyproxy.io
  3. cluster: service_envoyproxy_io
  4. clusters:
  5. - name: service_envoyproxy_io
  6. type: LOGICAL_DNS
  7. # Comment out the following line to test on v6 networks
  8. dns_lookup_family: V4_ONLY
  9. load_assignment:
  10. cluster_name: service_envoyproxy_io
  11. endpoints:
  12. - lb_endpoints:
  13. - endpoint:
  14. address:
  15. socket_address:
  16. address: www.envoyproxy.io
  17. port_value: 443
  18. transport_socket:
  19. name: envoy.transport_sockets.tls
  20. typed_config:
  21. "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
  22. sni: www.envoyproxy.io