Simple TCP Load Balancing

Hey all.

I have what should I think should be a simple setup but I'm struggling to get it going and I'm hoping someone here can help.

I'm using Consul and Nomad scheduled docker containers. I'd like three entrypoints connected to one router, load balancing across three containers (using dynamic ports) that can live on any one of three hosts.

I've got this working with a single entrypoint attached to a single router routing to a single container using labels/tags like this:


I can also get this working with three entrypoints. However, if I want to actually load balance across three containers/services, how do I do it?

If I add the labels above to all three containers I get errors about the same router being defined multiple times. I've also tried statically configuring the router to no avail. I suspect there's a simple answer to this but I've not been able to find it.


OK, so I seem to have fixed half of this (a single service with three servers) by simply adding the following labels to each container:


However, I'm still confused about the router configuration. I can add a definition using labels to one of the containers and that works, but if that particular container fails I've lost my router. I've tried doing this statically in the config file but it seems to be ignored:

    entryPoints = ["e1","e2","e3"]
    rule = "HostSNI(`*`)"
    service = "stuff"

Hi @sjiveson

Move the router to the traefik container in that case. This is where I put weird things that I can't pin on any other container/service.

For your toml, you you'd need to define the service as "stuff@consul". Without an @provider it will default to the same provider type where the router is defined.

Thank you, that worked, once I'd tweak the Consul constraints.

This also worked without causing duplicate the router error messages:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.