How we can map a common ip to all worker ip in docker swarm

As we know that in docker swarm we create multiple worker and one manager. The conatiner is running in mutliple worker. So we can access that in the browser by putting that worker node ip and then port like (ip:80). We can access another worker node by putting their ip and port. But What if I want that I run put one commone IP and run the container. So if anyh one of the nodes goes down then It my site does not goes down. it use another runnig worker.

worker1: 192.168.99.100:80 wokere2: 192.168.99.100:80 worker3: 192.168.99.100:80

I want one common IP so that if any one goes down the it should not goes down.

1 answer

  • answered 2022-05-04 17:58 matic1123

    You basically have primarily two ways of doing this:

    • You can put an HTTP proxy in front of the docker swarm, and then this proxy has health check routes on the node if any goes down the proxy removes the IP of the downed node from rotation until it comes back up (traefik, Nginx, caddy, ...).
    • You can use keepalived, and with this approach, you point the domain to your virtual VRRP IP which then is "floating" around.

    I know a very good ops person and they use keepalived in their company without any issues and complications. In our company, we decided to go with the proxy because we also route other "traffic" over them to different systems (legacy, ...) and we have VMWare's top licence with veeam and we can solve real-time duplications (in case of VM going down and such) with that.

    So both methods are proven and tested :)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum