How to add consul registry in istio

8/31/2020

I want to add a consul registry in istio, but the istio documentation only has the pilot-discovery discovery command with the parameters:

--consulserverURL <string>
--registries <stringSlice>

But I don’t know how to write command line parameters into the configuration file, and the istio document does not describe how to do this.

Please advise, thanks!

-- Souther Dawn
consul
istio
kubernetes

1 Answer

9/1/2020

As mentioned in istio documentation you can use

pilot-discovery discovery [flags]

Pilot is part of istiod now, so you can get your istio pods with

kubectl get pods -n istio-system

Use kubectl exec to get into your istiod container with

kubectl exec -ti <istiod-pod-name> -c discovery -n istio-system -- /bin/bash

Use above pilot-discovery command with appropriate flags

e.g.

pilot-discovery discovery --consulserverURL="asd.x.svc:9999" --registries="{Kubernetes,Consul}"

2020-09-01T09:16:43.528744Z     info    FLAG: --consulserverURL="asd.x.svc:9999"
2020-09-01T09:16:43.529136Z     info    FLAG: --registries="[{Kubernetes,Consul}]"
-- Jakub
Source: StackOverflow