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. 1static_resources:
  2. 2
  3. 3 listeners:

listeners

The example configures a listener on port 10000.

All paths are matched and routed to the service_envoyproxy_io cluster.

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

clusters

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

  1. 29 - match:
  2. 30 prefix: "/"
  3. 31 route:
  4. 32 host_rewrite_literal: www.envoyproxy.io
  5. 33 cluster: service_envoyproxy_io
  6. 34
  7. 35 clusters:
  8. 36 - name: service_envoyproxy_io
  9. 37 type: LOGICAL_DNS
  10. 38 # Comment out the following line to test on v6 networks
  11. 39 dns_lookup_family: V4_ONLY
  12. 40 load_assignment:
  13. 41 cluster_name: service_envoyproxy_io
  14. 42 endpoints:
  15. 43 - lb_endpoints:
  16. 44 - endpoint:
  17. 45 address:
  18. 46 socket_address:
  19. 47 address: www.envoyproxy.io
  20. 48 port_value: 443
  21. 49 transport_socket:
  22. 50 name: envoy.transport_sockets.tls
  23. 51 typed_config: