1

This is probably a simple question but I am wondering how others do this.

I have a Docker Swarm Mode cluster with 3 managers. Lets say they have the IP's

  • 192.168.1.10
  • 192.168.1.20
  • 192.168.1.30

I can access my web container through any of the IP's, through the internal routing mesh etc. But incase the host goes down with the IP I access my web container with I obviously won't get routed to the container any more. So I need some kind of single DNS record or something that points me to an active address in my cluster.

How do you guys do this? Should I add all three IP's as A records to the DNS? Or have a load balancer / reverse proxy infront of the cluster?

I suppose there is more than one solution, would be nice to hear how others solved this :-)

Thanks a lot

Matteo
  • 232
  • 3
  • 17

1 Answers1

0

Assuming your web server was started something like this:

docker service create --replicas=1 -p 80:80 nginx:alpine

The cluster will attempt to reschedule that one replica should the replica go down for any reason. With only 1 replica, you may experience some downtime between the old task going away, in the new task coming up somewhere else.

Part of the design goal of the routing mesh feature was indeed to simplify load-balancing configuration. Because all members of the cluster listen on port 80 in my example, your load balancer can simply be configured to listen to all three ips. Assuming the load balancer can properly detect the one node going down, the task will get rescheduled somewhere in the cluster, and any of the two remaining nodes will be able to route traffic via the routing mesh.

programmerq
  • 6,262
  • 25
  • 40
  • That was what we were about to setup. I was wondering what kind of "external" load balancer or reverse proxy in front of the swarm is most common? HAProxy, nginx or a NLB? any suggestion what is kind of a "best practice"? – Matteo Jun 23 '17 at 06:41
  • Generally speaking, I would recommend putting a layer 3 load balancer in front of the swarm mode routing mesh. I find it much more common to haproxy and nginx running inside the swarm mode cluster. – programmerq Jun 23 '17 at 16:48