Hello guys,
I'm trying to implement Traefik as a TCP Proxy for several mongoDB servers, but something it's not working.
I have several deployments for my developers, dev, staging, qa, etc and each of them are a suite of containers like backend, mongo, log-shipper etc.
For each of this deployments, I'm registering different http routers in Traefik, for example mybachend-dev.mydomain.com, mybackend-staging.mydomain.com, etc and everything works fine except mongo part.
This is my main goal: for each deployment in different environments, I want to have a TCP endpoint to the respective mongo instance.
This are the labels that I'm using to do it:
"traefik.tags=trk",
"traefik.tcp.routers.mongo-dev.entrypoints=mongo",
"traefik.tcp.routers.mongo-dev.rule=HostSNI(`mongo-dev.mydomain.dev`)",
"traefik.tcp.routers.mongo-dev.service=mongo-svc",
"traefik.tcp.routers.mongo-dev.tls=true",
"traefik.tcp.services.mongo-svc.loadBalancer.server.address=${NOMAD_ADDR_mongo_db}",
As you can see I'm using Nomad and Consul to help me with all this environments, but this config it's not working.
I made some tries, and I found that if I change this line "traefik.tcp.routers.mongo-dev.rule=HostSNI(
mongo-dev.mydomain.dev )"
to this "traefik.tcp.routers.mongo-dev.rule=HostSNI(
* )"
, it works (I can use Mongo Compass to access to the databases) but I'm afraid that, with several TCP Routers (for the different environments - mongo-dev.mydomain.dev, mongo-staging.mydomain.dev, etc), it will not make differentiate between the different mongo hosts and start to make a round robin choise.
I'm using Traefik v 2.1.4
What am I doing wrong?
Thanks a lot.