Examples

    A minimal fully static bootstrap config is provided below:

    A bootstrap config that continues from the above example with dynamic endpoint discovery via an gRPC management server listening on 127.0.0.1:5678 is provided below:

    1. address:
    2. socket_address: { address: 127.0.0.1, port_value: 9901 }
    3. static_resources:
    4. listeners:
    5. - name: listener_0
    6. address:
    7. socket_address: { address: 127.0.0.1, 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. codec_type: AUTO
    15. route_config:
    16. name: local_route
    17. virtual_hosts:
    18. - name: local_service
    19. domains: ["*"]
    20. routes:
    21. - match: { prefix: "/" }
    22. route: { cluster: some_service }
    23. http_filters:
    24. - name: envoy.filters.http.router
    25. clusters:
    26. - name: some_service
    27. connect_timeout: 0.25s
    28. lb_policy: ROUND_ROBIN
    29. type: EDS
    30. eds_cluster_config:
    31. eds_config:
    32. resource_api_version: V3
    33. api_config_source:
    34. api_type: GRPC
    35. transport_api_version: V3
    36. grpc_services:
    37. - envoy_grpc:
    38. cluster_name: xds_cluster
    39. - name: xds_cluster
    40. connect_timeout: 0.25s
    41. type: STATIC
    42. lb_policy: ROUND_ROBIN
    43. typed_extension_protocol_options:
    44. envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
    45. "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
    46. explicit_http_config:
    47. http2_protocol_options:
    48. connection_keepalive:
    49. interval: 30s
    50. timeout: 5s
    51. # configure a TCP keep-alive to detect and reconnect to the admin
    52. # server in the event of a TCP socket half open connection
    53. tcp_keepalive: {}
    54. cluster_name: xds_cluster
    55. endpoints:
    56. - lb_endpoints:
    57. - endpoint:
    58. address:
    59. socket_address:
    60. address: 127.0.0.1
    61. port_value: 5678

    Notice above that xds_cluster is defined to point Envoy at the management server. Even in an otherwise completely dynamic configurations, some static resources need to be defined to point Envoy at its xDS management server(s).

    It’s important to set appropriate TCP Keep-Alive options in the tcp_keepalive block. This will help detect TCP half open connections to the xDS management server and re-establish a full connection.

    In the above example, the EDS management server could then return a proto encoding of a :

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    4. cluster_name: some_service
    5. endpoints:
    6. - lb_endpoints:
    7. - endpoint:
    8. address:
    9. socket_address:
    10. address: 127.0.0.1
    11. port_value: 1234

    A fully dynamic bootstrap configuration, in which all resources other than those belonging to the management server are discovered via xDS is provided below:

    The management server could respond to LDS requests with:

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.config.listener.v3.Listener
    4. name: listener_0
    5. address:
    6. socket_address:
    7. address: 127.0.0.1
    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. codec_type: AUTO
    16. rds:
    17. route_config_name: local_route
    18. config_source:
    19. resource_api_version: V3
    20. api_config_source:
    21. api_type: GRPC
    22. transport_api_version: V3
    23. grpc_services:
    24. - envoy_grpc:
    25. cluster_name: xds_cluster
    26. http_filters:
    27. - name: envoy.filters.http.router

    The management server could respond to RDS requests with:

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.config.route.v3.RouteConfiguration
    4. name: local_route
    5. virtual_hosts:
    6. - name: local_service
    7. routes:
    8. route: { cluster: some_service }

    The management server could respond to CDS requests with:

    The management server could respond to EDS requests with:

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    4. cluster_name: some_service
    5. endpoints:
    6. - lb_endpoints:
    7. - endpoint:
    8. address:
    9. socket_address:
    10. address: 127.0.0.1
    11. port_value: 1234

    This lets you split your file into two parts: one in which we have YAML content not subject to parsing according to the schema and another part that is parsed. YAML anchors in the first part may be referenced by aliases in the second part. This mechanism can simplify setups that need to re-use or dynamically generate configuration fragments.

    See the following example:

    1. !ignore dynamic_sockets:
    2. - &admin_address {address: 127.0.0.1, port_value: 9901}
    3. - &listener_address {address: 127.0.0.1, port_value: 10000}
    4. - &lb_address {address: 127.0.0.1, port_value: 1234}
    5. admin:
    6. address:
    7. socket_address: *admin_address
    8. static_resources:
    9. listeners:
    10. - name: listener_0
    11. address:
    12. socket_address: *listener_address
    13. filter_chains:
    14. - filters:
    15. - name: envoy.filters.network.http_connection_manager
    16. typed_config:
    17. "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
    18. stat_prefix: ingress_http
    19. codec_type: AUTO
    20. route_config:
    21. name: local_route
    22. virtual_hosts:
    23. - name: local_service
    24. domains: ["*"]
    25. routes:
    26. - match: {prefix: "/"}
    27. route: {cluster: some_service}
    28. http_filters:
    29. - name: envoy.filters.http.router
    30. clusters:
    31. - name: some_service
    32. connect_timeout: 0.25s
    33. type: STATIC
    34. lb_policy: ROUND_ROBIN
    35. load_assignment:
    36. cluster_name: some_service
    37. endpoints:
    38. - lb_endpoints:
    39. - endpoint:
    40. address:

    Warning

    If you parse Envoy YAML configuration using external loaders, you may need to inform these loaders about the !ignore tag. Compliant YAML loaders will typically expose an interface to allow you to choose how to handle a custom tag.

    For example, this will instruct PyYAML to treat an ignored node as a simple scalar when loading: