Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
36 lines
1.2 KiB
Markdown
36 lines
1.2 KiB
Markdown
# gRPC xDS example
|
|
|
|
xDS is the protocol initially used by Envoy, that is evolving into a universal
|
|
data plane API for service mesh.
|
|
|
|
The xDS example is a Hello World client/server capable of being configured with
|
|
the XDS management protocol. Out-of-the-box it behaves the same as [our other
|
|
hello world
|
|
example](https://github.com/grpc/grpc-go/tree/master/examples/helloworld). The
|
|
server replies with responses including its hostname.
|
|
|
|
## xDS environment setup
|
|
|
|
This example doesn't include instructions to setup xDS environment. Please refer
|
|
to documentation specific for your xDS management server. Examples will be added
|
|
later.
|
|
|
|
The client also needs a bootstrap file. See [gRFC
|
|
A27](https://github.com/grpc/proposal/blob/master/A27-xds-global-load-balancing.md#xdsclient-and-bootstrap-file)
|
|
for the bootstrap format.
|
|
|
|
## The client
|
|
|
|
The client application needs to import the xDS package to install the resolver and balancers:
|
|
|
|
```go
|
|
_ "google.golang.org/grpc/xds" // To install the xds resolvers and balancers.
|
|
```
|
|
|
|
Then, use `xds` target scheme for the ClientConn.
|
|
|
|
```
|
|
$ export GRPC_XDS_BOOTSTRAP=/path/to/bootstrap.json
|
|
$ go run client/main.go "xDS world" xds:///target_service
|
|
```
|