Overview

    • Streaming delivery of xDS API updates via gRPC. This reduces resource requirements and can lower the update latency.
    • A new REST-JSON API in which the JSON/YAML formats are derived mechanically via the .
    • Delivery of updates via the filesystem, REST-JSON or gRPC endpoints.
    • Advanced load balancing through an extended endpoint assignment API and load and resource utilization reporting to management servers.
    • Stronger consistency and ordering properties when needed. The v2 APIs still maintain a baseline eventual consistency model.

    See the for further details on aspects of v2 message exchange between Envoy and the management server.

    To use the v2 API, it’s necessary to supply a bootstrap configuration file. This provides static server configuration and configures Envoy to access dynamic configuration if needed. This is supplied on the command-line via the flag, i.e.:

    where the extension reflects the underlying v2 config representation.

    The Bootstrap message is the root of the configuration. A key concept in the message is the distinction between static and dynamic resouces. Resources such as a Listener or may be supplied either statically in static_resources or have an xDS service such as or CDS configured in .

    Example

    Below we will use YAML representation of the config protos and a running example of a service proxying HTTP from 127.0.0.1:10000 to 127.0.0.2:1234.

    A minimal fully static bootstrap config is provided below:

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

    A bootstrap config that continues from the above example with via an EDS gRPC management server listening on 127.0.0.3:5678 is provided below:

    1. admin:
    2. access_log_path: /tmp/admin_access.log
    3. address:
    4. socket_address: { address: 127.0.0.1, port_value: 9901 }
    5. static_resources:
    6. listeners:
    7. - name: listener_0
    8. address:
    9. socket_address: { address: 127.0.0.1, port_value: 10000 }
    10. filter_chains:
    11. - filters:
    12. - name: envoy.http_connection_manager
    13. config:
    14. stat_prefix: ingress_http
    15. codec_type: AUTO
    16. route_config:
    17. name: local_route
    18. virtual_hosts:
    19. - name: local_service
    20. domains: ["*"]
    21. routes:
    22. - match: { prefix: "/" }
    23. route: { cluster: some_service }
    24. - name: envoy.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. api_config_source:
    33. api_type: GRPC
    34. grpc_services:
    35. envoy_grpc:
    36. cluster_name: xds_cluster
    37. - name: xds_cluster
    38. connect_timeout: 0.25s
    39. type: STATIC
    40. lb_policy: ROUND_ROBIN
    41. load_assignment:
    42. cluster_name: xds_cluster
    43. endpoints:
    44. - lb_endpoints:
    45. - endpoint:
    46. address:
    47. socket_address:
    48. address: 127.0.0.1
    49. 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).

    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.api.v2.ClusterLoadAssignment
    4. cluster_name: some_service
    5. endpoints:
    6. - lb_endpoints:
    7. - endpoint:
    8. address:
    9. socket_address:
    10. address: 127.0.0.2
    11. port_value: 1234

    The versioning and type URL scheme that appear above are explained in more detail in the streaming gRPC subscription protocol documentation.

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

    1. admin:
    2. access_log_path: /tmp/admin_access.log
    3. address:
    4. socket_address: { address: 127.0.0.1, port_value: 9901 }
    5. dynamic_resources:
    6. lds_config:
    7. api_config_source:
    8. api_type: GRPC
    9. grpc_services:
    10. envoy_grpc:
    11. cluster_name: xds_cluster
    12. cds_config:
    13. api_config_source:
    14. api_type: GRPC
    15. grpc_services:
    16. envoy_grpc:
    17. cluster_name: xds_cluster
    18. static_resources:
    19. clusters:
    20. - name: xds_cluster
    21. connect_timeout: 0.25s
    22. type: STATIC
    23. lb_policy: ROUND_ROBIN
    24. http2_protocol_options: {}
    25. load_assignment:
    26. cluster_name: xds_cluster
    27. endpoints:
    28. - lb_endpoints:
    29. - endpoint:
    30. address:
    31. socket_address:
    32. address: 127.0.0.1
    33. port_value: 5678

    The management server could respond to LDS requests with:

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.api.v2.Listener
    4. name: listener_0
    5. address:
    6. socket_address:
    7. address: 127.0.0.1
    8. port_value: 10000
    9. filter_chains:
    10. - name: envoy.http_connection_manager
    11. config:
    12. stat_prefix: ingress_http
    13. codec_type: AUTO
    14. rds:
    15. route_config_name: local_route
    16. config_source:
    17. api_config_source:
    18. api_type: GRPC
    19. grpc_services:
    20. envoy_grpc:
    21. cluster_name: xds_cluster
    22. http_filters:
    23. - name: envoy.router

    The management server could respond to RDS requests with:

    1. version_info: "0"
    2. resources:
    3. - "@type": type.googleapis.com/envoy.api.v2.RouteConfiguration
    4. virtual_hosts:
    5. - name: local_service
    6. domains: ["*"]
    7. routes:
    8. - match: { prefix: "/" }
    9. 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.api.v2.ClusterLoadAssignment
    4. cluster_name: some_service
    5. endpoints:
    6. - lb_endpoints:
    7. - endpoint:
    8. address:
    9. socket_address:
    10. address: 127.0.0.2
    11. port_value: 1234

    While new v2 bootstrap JSON/YAML can be written, it might be expedient to upgrade an existing v1 JSON/YAML configuration to v2. To do this (in an Envoy source tree), you can run:

    1. bazel run //tools:v1_to_bootstrap <path to v1 JSON/YAML configuration file>

    Management server

    A v2 xDS management server will implement the below endpoints as required for gRPC and/or REST serving. In both streaming gRPC and REST-JSON cases, a DiscoveryRequest is sent and a received following the xDS protocol.

    POST /envoy.api.v2.ClusterDiscoveryService/StreamClusters

    See cds.proto for the service definition. This is used by Envoy as a client when

    1. cds_config:
    2. api_config_source:
    3. api_type: GRPC
    4. grpc_services:
    5. envoy_grpc:
    6. cluster_name: some_xds_cluster

    POST /envoy.api.v2.EndpointDiscoveryService/StreamEndpoints

    See eds.proto for the service definition. This is used by Envoy as a client when

    1. eds_config:
    2. api_config_source:
    3. api_type: GRPC
    4. grpc_services:
    5. envoy_grpc:
    6. cluster_name: some_xds_cluster

    is set in the field of the Cluster config.

    POST /envoy.api.v2.ListenerDiscoveryService/StreamListeners

    See lds.proto for the service definition. This is used by Envoy as a client when

    1. lds_config:
    2. api_config_source:
    3. api_type: GRPC
    4. grpc_services:
    5. envoy_grpc:
    6. cluster_name: some_xds_cluster

    is set in the of the Bootstrap config.

    POST /envoy.api.v2.RouteDiscoveryService/StreamRoutes

    See rds.proto for the service definition. This is used by Envoy as a client when

    1. route_config_name: some_route_name
    2. config_source:
    3. api_config_source:
    4. api_type: GRPC
    5. grpc_services:
    6. envoy_grpc:
    7. cluster_name: some_xds_cluster

    is set in the field of the HttpConnectionManager config.

    POST /v2/discovery:clusters

    See cds.proto for the service definition. This is used by Envoy as a client when

    is set in the of the Bootstrap config.

    POST /v2/discovery:endpoints

    See eds.proto for the service definition. This is used by Envoy as a client when

    1. eds_config:
    2. api_config_source:
    3. api_type: REST
    4. cluster_names: [some_xds_cluster]

    is set in the field of the Cluster config.

    POST /v2/discovery:listeners

    See lds.proto for the service definition. This is used by Envoy as a client when

    1. lds_config:
    2. api_config_source:
    3. api_type: REST
    4. cluster_names: [some_xds_cluster]

    is set in the of the Bootstrap config.

    POST /v2/discovery:routes

    1. route_config_name: some_route_name
    2. config_source:
    3. api_config_source:
    4. api_type: REST
    5. cluster_names: [some_xds_cluster]

    is set in the rds field of the config.

    While Envoy fundamentally employs an eventual consistency model, ADS provides an opportunity to sequence API update pushes and ensure affinity of a single management server for an Envoy node for API updates. ADS allows one or more APIs and their resources to be delivered on a single, bidirectional gRPC stream by the management server. Without this, some APIs such as RDS and EDS may require the management of multiple streams and connections to distinct management servers.

    ADS will allow for hitless updates of configuration by appropriate sequencing. For example, suppose foo.com was mappped to cluster X. We wish to change the mapping in the route table to point foo.com at cluster Y. In order to do this, a CDS/EDS update must first be delivered containing both clusters X and Y.

    Without ADS, the CDS/EDS/RDS streams may point at distinct management servers, or when on the same management server at distinct gRPC streams/connections that require coordination. The EDS resource requests may be split across two distinct streams, one for X and one for Y. ADS allows these to be coalesced to a single stream to a single management server, avoiding the need for distributed synchronization to correctly sequence the update. With ADS, the management server would deliver the CDS, EDS and then RDS updates on a single stream.

    ADS is only available for gRPC streaming (not REST) and is described more fully in this document. The gRPC endpoint is:

    POST /envoy.api.v2.AggregatedDiscoveryService/StreamAggregatedResources

    See discovery.proto for the service definition. This is used by Envoy as a client when

    1. ads_config:
    2. api_type: GRPC
    3. grpc_services:
    4. envoy_grpc:
    5. cluster_name: some_ads_cluster

    is set in the of the Bootstrap config.

    When this is set, any of the configuration sources can be set to use the ADS channel. For example, a LDS config could be changed from

    1. lds_config:
    2. api_config_source:
    3. api_type: REST

    to

    1. lds_config: {ads: {}}

    with the effect that the LDS stream will be directed to some_ads_cluster over the shared ADS channel.

    Management Server Unreachability

    When an Envoy instance loses connectivity with the management server, Envoy will latch on to the previous configuration while actively retrying in the background to reestablish the connection with the management server.

    Envoy debug logs the fact that it is not able to establish a connection with the management server every time it attempts a connection.

    statistic provides a signal for monitoring this behavior.

    Management Server has a statistics tree rooted at control_plane. with the following statistics:

    Status

    All features described in the are implemented unless otherwise noted. In the v2 API reference and the v2 API repository, all protos are frozen unless they are tagged as draft or experimental. Here, frozen means that we will not break wire format compatibility.

    Frozen protos may be further extended, e.g. by adding new fields, in a manner that does not break . Fields in the above protos may be later deprecated, subject to the breaking change policy, when their related functionality is no longer required. While frozen APIs have their wire format compatibility preserved, we reserve the right to change proto namespaces, file locations and nesting relationships, which may cause breaking code changes. We will aim to minimize the churn here.

    Protos tagged draft, meaning that they are near finalized, are likely to be at least partially implemented in Envoy but may have wire format breaking changes made prior to freezing.

    Protos tagged experimental, have the same caveats as draft protos and may have have major changes made prior to Envoy implementation and freezing.