Consul provider - how to connect to all 3 consul servers

traefik version: 2.2.5

I am working in a managed cloud kubernetes cluster and i have setup consul:
Here are the 3 consul servers
hashicorp-consul-server-0 1/1 Running 0 30d
hashicorp-consul-server-1 1/1 Running 0 30d
hashicorp-consul-server-2 1/1 Running 0 30d
Here are the services for consul
hashicorp-consul-dns ClusterIP 53/TCP,53/UDP
hashicorp-consul-server ClusterIP None 8500/TCP,8301/TCP,8301/UDP,8302/TCP,8302/UDP,8300/TCP,8600/TCP,8600/UDP
hashicorp-consul-ui ClusterIP 80/TCP

On my traefik ingress controller, I have enabled these consul provider configurations as per traefik's consul documentation ( :

  • "--providers.consulcatalog=true"
  • "--providers.consulcatalog.prefix=traefik"
  • "--providers.consulcatalog.endpoint.address=http://"

When i deployed traefik and looked at the logs, I am getting
Get "": dial tcp connect: connection refused" providerName=consulcatalog
Provider connection error Get "": dial tcp connect: connection refused, retrying in 535.639805ms"

When i tried to connect to one of my servers like

  • "--providers.consulcatalog.endpoint.address= :8500", it had no errors

Interestingly, when i tried http://hashicorp-consul-server:8500 and use a curl witihn one of consul server, the curl works, but when i used

  • "--providers.consulcatalog.endpoint.address=http://hashicorp-consul-server:8500"
    time="2020-08-07T19:45:23Z" level=error msg="error get consul catalog data, Get "http://hashicorp-consul-server:8500/v1/catalog/services": dial tcp: lookup hashicorp-consul-server on no such host" providerName=consulcatalog
    time="2020-08-07T19:45:23Z" level=error msg="Provider connection error Get "http://hashicorp-consul-server:8500/v1/catalog/services": dial tcp: lookup hashicorp-consul-server on no su
    ch host, retrying in 406.49185ms" providerName=consulcatalog
    that is from the kube dns.

Is there a way to use one ip address or domain which can route to all 3 consul servers?

Thank you. Hoping to hear an answer :slight_smile:

note that i have tried

and i do not have any errors on consul connection.
Any other solutions are welcome too.