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.

1static_resources:
2
3  listeners:

listeners

The example configures a listener on port 10000.

All paths are matched and routed to the service_envoyproxy_io cluster.

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

clusters

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

29                route:
30                  host_rewrite_literal: www.envoyproxy.io
31                  cluster: service_envoyproxy_io
32
33  clusters:
34  - name: service_envoyproxy_io
35    connect_timeout: 30s
36    type: LOGICAL_DNS
37    # Comment out the following line to test on v6 networks
38    dns_lookup_family: V4_ONLY
39    load_assignment:
40      cluster_name: service_envoyproxy_io
41      endpoints:
42      - lb_endpoints:
43        - endpoint:
44            address:
45              socket_address:
46                address: www.envoyproxy.io
47                port_value: 443
48    transport_socket:
49      name: envoy.transport_sockets.tls
50      typed_config:
51        "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
52        sni: www.envoyproxy.io