# Consul provider - how to connect to all 3 consul servers

**URL:** <https://community.traefik.io/t/consul-provider-how-to-connect-to-all-3-consul-servers/7229>\
**Category:** Traefik v2\
**Tags:** consul-catalog\
**Created:** [August 7, 2020, 8:58pm UTC](https://community.traefik.io/t/consul-provider-how-to-connect-to-all-3-consul-servers/7229 "2020-08-07T20:58:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taro](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/taro/32/2441_2.png) [@taro](https://community.traefik.io/u/taro)\
**Post date:** [August 7, 2020, 8:58pm UTC](https://community.traefik.io/t/consul-provider-how-to-connect-to-all-3-consul-servers/7229/1 "2020-08-07T20:58:25Z")

</div>

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 10.244.2.12  
hashicorp-consul-server-1 1/1 Running 0 30d 10.244.1.13  
hashicorp-consul-server-2 1/1 Running 0 30d 10.244.0.10  
Here are the services for consul  
NAME TYPE CLUSTER-IP PORT(S) AGE  
hashicorp-consul-dns ClusterIP 10.96.112.126 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 10.96.199.36 80/TCP

On my traefik ingress controller, I have enabled these consul provider configurations as per traefik's consul documentation ([https://docs.traefik.io/providers/consul-catalog/](https://docs.traefik.io/providers/consul-catalog/)) :

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

When i deployed traefik and looked at the logs, I am getting  
Get "[http://127.0.0.1:8500/v1/catalog/services](http://127.0.0.1:8500/v1/catalog/services)": dial tcp 127.0.0.1:8500: connect: connection refused" providerName=consulcatalog  
Provider connection error Get "[http://127.0.0.1:8500/v1/catalog/services](http://127.0.0.1:8500/v1/catalog/services)": dial tcp 127.0.0.1:8500: connect: connection refused, retrying in 535.639805ms"

When i tried to connect to one of my servers like

- "--providers.consulcatalog.endpoint.address=http://10.244.2.12 :8500", it had no errors

Interestingly, when i tried [http://hashicorp-consul-server:8500](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](http://hashicorp-consul-server:8500/v1/catalog/services)": dial tcp: lookup hashicorp-consul-server on 10.96.5.5:53: 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](http://hashicorp-consul-server:8500/v1/catalog/services)": dial tcp: lookup hashicorp-consul-server on 10.96.5.5:53: no su  
ch host, retrying in 406.49185ms" providerName=consulcatalog  
that 10.96.5.5:53 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 🙂

---

<div class="post-metadata">

**Author:** ![taro](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/taro/32/2441_2.png) [@taro](https://community.traefik.io/u/taro)\
**Post date:** [August 7, 2020, 9:17pm UTC](https://community.traefik.io/t/consul-provider-how-to-connect-to-all-3-consul-servers/7229/2 "2020-08-07T21:17:10Z")

</div>

note that i have tried  
"--providers.consulcatalog.endpoint.address=http://hashicorp-consul-server..svc.cluster.local:8500"

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