I’m facing wired behavior of Swarm. I’ve formed 3 node Swarm cluster on my laptop and run single service with 3 replicas. When calling the service via my laptop browser I always get routed to the same service. However, if I ssh to one of the Swarm nodes and run curl I get RR load balanced each and every request.
I was expecting that my requests from the browser will be RR load balanced as well.
Information:
3 VMs running on my laptop
Linux version: Centos Linux manager 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64
Docker Version:
Client:
Version: 17.09.1-ce
API version: 1.32
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:23:40 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.1-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:25:03 2017
OS/Arch: linux/amd64
Experimental: false
Steps to reproduce:
- Form 3 node Swarm cluster
- Create overlay network:
docker network create --opt encrypted --driver overlay overlay1 - Run simple web service to return the Swarm node host name on which the task is running:
docker service create --name web --replicas 3 --mount type=bind,src=/etc/hostname,dst=/usr/share/nginx/html/index.html,readonly --publish 80:80 nginx - Login to one of the Swarm nodes and run:
curl 192.168.72.128
Result: Each time the respond is from different task - Open browser and type one of the Swarm nodes URL. For example:
http://192.168.72.11
Result: Each and every browser respond with the same task answering the request
What am I missing here?