This xDS example builds on the Hello World Example and changes the gRPC client and server to accept configuration from an xDS control plane.
The client takes two command-line arguments -
InsecureChannelCredentials
. If unset, InsecureChannelCredentials
will be used.The server takes three command-line arguments -
maintenance_port
is unused, and the Admin service is just exposed on port
. Defaults to 50052.InsecureServerCredentials
. If unset, InsecureServerCredentials
will be used.Currently, this example and some of the gRPC xDS libraries that it depends on only builds with bazel. CMake support will be introduced in the future.
To use XDS, you should first deploy the XDS management server in your deployment environment and know its name. You need to set the GRPC_XDS_BOOTSTRAP
environment variable to point to the gRPC XDS bootstrap file (see gRFC A27 for the bootstrap format). This is needed by both client and server.
Please view GCP instructions as an example.
To run the server -
$ export GRPC_XDS_BOOTSTRAP=/path/to/bootstrap.json $ tools/bazel run examples/cpp/xds:greeter_server
To run the client -
$ export GRPC_XDS_BOOTSTRAP=/path/to/bootstrap.json $ tools/bazel run examples/cpp/xds:greeter_client