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            typed_config:
22              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
23          route_config:
24            name: local_route
25            virtual_hosts:
26            - name: local_service
27              domains: ["*"]
28              routes:
29              - match:
30                  prefix: "/"
31                route:
32                  host_rewrite_literal: www.envoyproxy.io
33                  cluster: service_envoyproxy_io

clusters

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

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