Hey everyone! I'm working on a project where I'm setting up a Docker Swarm cluster. I've got 3 worker nodes and 3 management nodes in mind, and everything is going smoothly so far. Now I'm trying to figure out the best way to expose my containers to the rest of the network. I read a post about deploying HAProxy and using keepalived to set up a load balancer across the nodes. This seems like a good setup because it provides quick failover in case a node becomes unavailable. I'd love to hear how you all manage load balancing in your Docker Swarm setups. Any feedback or tips would be greatly appreciated! Thanks!
5 Answers
Using the ingress routing mesh and publishing service ports has worked really well for me. I also set up Kong Gateway in front of my swarm, directing traffic to each node at the published service port. It's been a solid solution!
That sounds interesting! I've been looking into deploying a load balancer outside the cluster too.
I’m not quite sure I get the full picture. Isn't your plan already detailed in the post you referenced? What additional info are you looking for?
What specific services do you plan to expose through the swarm? That might help narrow down the best approach for your load balancing needs.
Your plan for HAProxy with keepalived sounds good! I've had success with it, and the failover speed should be impressive. If you're looking for a simpler alternative, ClawCloud Run might be worth considering. It's easy to set up, and it takes care of scaling and load balancing for you, which has saved me a lot of time.
Have you considered using Traefik? It's a useful option for load balancing, especially if you're looking for high availability with a lot of features.
I'm more focused on the deployment and usage aspect right now. Any tips on how to achieve HA?
I have a similar setup, actually.