go-chassis can be integrated with Istio for service discovery and routing. To enable Istio pilot support in go-chassis, the simple 2 steps are needed during development:
- Import the istiov2 registry plugin from mesher
import _ "github.com/go-mesh/mesher/plugins/registry/istiov2"
This will install the istiov2 service discovery plugin at runtime.
- Configure service discovery in chassis.yaml
cse: service: registry: registrator: disabled: true serviceDiscovery: type: pilotv2 address: grpc://istio-pilot.istio-system:15010
Disable the registrator(since we don’t have to register the service to Pilot explicitly) and change serviceDiscovery type to
pilotv2(indicates the Pilot that provides xDS v2 API, the xDS v1 API is already deprecated), configure the address, typically
istio-pilot.istio-sytem:15010 in a Istio environment.
Then when deploying the micro services in Istio, make sure the Kubernetes Services’ name and go-chassis service name is exactly the same, then go-chassis will discovery the service instances as expected from Pilot.