Chapter 19: Name Resolution and Service Discovery
gRPC Name Resolution
When you create a channel with a target like "dns:///myservice:50051", gRPC resolves it to IP addresses using a pluggable resolver.
Built-in Resolvers
| Scheme | Example | How It Resolves |
|---|---|---|
| dns | dns:///myservice:50051 | DNS A/AAAA records |
| static | static:///10.0.1.1:50051,10.0.1.2:50051 | Hardcoded list |
| xds | xds:///myservice | xDS protocol (Envoy/Istio) |
Custom Resolvers
You can implement custom resolvers for Consul, etcd, ZooKeeper, or any service registry. The resolver watches for changes and updates the channel's address list dynamically.
xDS (Envoy Discovery Service)
The most powerful option: gRPC speaks the xDS protocol natively (same as Envoy). A control plane (Istio) pushes routing config, load balancing policy, and backend lists to gRPC clients directly — no sidecar proxy needed.