Round Robin SWARM Docker container behavior not working across multiple hosts

If the swarm service is deployed on a 2 node cluster (1manager + 1worker). Assuming replicas are set to 3, containers will be launched: 2 in one node and 1 in another node.

When the curl command hits the IP address manager or worker - the container located on the same host is served in an RR way. The request is not served by another node, so the target of failover or HA (across multiple nodes) is not achieved for me for this configuration.

Let me share with you the detailed steps I took: https://privatedock.wordpress.com/2017/04/09/docker-swarm/

Please let me know if I missed something. Thank you in advance.

+3


source to share


1 answer


I see you are deploying to AWS and using Public IP for the Swarm advertising IP. Are you sure you want to do this? AWS Network charges are based on data coming over public IP. Have you opened your firewall rules for your public interface?

Port 7946 TCP/UDP for container network discovery.
Port 4789 UDP for the container overlay network.

      

You can exclude the firewall if you are using private IPs in your VPC. And you won't get paid for bandwidth.



Your service was also created with a load balancing VIP. If you need DNS RR you need to add --endpoint-mode dnsrr

to the command docker service create

.

You can check if DNS RR is working if the following python script is running in your container. Replace SERVICE_NAME with the service you want to resolve with.

python -c "import socket; print socket.gethostbyname_ex('SERVICE_NAME')[2]"

+2


source







All Articles