1

I have an architecture of microservices running into a docker swarm stack. My swarm stack is composed with :

  • 3 Managers (manager only)
  • 3 workers

I have an external load-balancer to dispatch requests on the nodes of my stack with a single public IP.

I'm wondering if my external load-balancer should route traffic only to the managers, only to the workers or to all nodes.

I didn't find any direct answers to this question in the swarm documentation but i think it is better to route traffic to wokers only in order to save resources of managers. Is it the right way to do it ?

Sébastien
  • 69
  • 1
  • 8

1 Answers1

1

yes. no. maybe.

If you have only one vip, you probably want it to point to the managers, because you want HA access to the managers to manage the swarm.

i.e. with my internal swarm, "swarm.example.com" is a vip that points to the managers. My CI/CD pipelines use that as their target when doing docker stack deploy operations, and this means I can perform node maintenance without breaking pipeline deployments. "*.swarm.example.com" is also, for convenience a CNAME to swarm.example.com, so all my http (and other) ingress arrives on the managers, which is where I deploy traefik (which needs access to the manager api via /var/lib/docker.sock) for ingress routing to services.

Now, a more sophisticated setup would be to use separate vip pools to manage the control plane and ingress routing, and having traefik on the manager nodes is a security concern, but that speaks to a much larger setup with greater security concerns than an on prem swarm running ci/cd for devs.

Chris Becke
  • 34,244
  • 12
  • 79
  • 148
  • Thanks, if i understand corectly. I can route traffic to workers only if i don't need to manage the swarm through the same unique vip. – Sébastien Mar 15 '22 at 14:00
  • 1
    it depends on your requirements. if you dont need ha access to the managers, then map the vip to workers. If you want simple HA with a single vip, map it to the managers. If you want full ha with a very secure setup: two vips are needed. – Chris Becke Mar 16 '22 at 05:22
  • 1
    Thanks for your answer. I only need vip on workers. – Sébastien Mar 16 '22 at 12:41