Skip to content

Cannot ping the VIP of a container by its service name across multi-host in 1.12 swarm mode #25497

@twang2218

Description

@twang2218

I cannot ping the container on another docker host by its service name if the --endpoint-mode is vip.

To reproduce the problem, I create a 2-node swarm cluster by following commands:

docker-machine create -d virtualbox node-1
docker-machine create -d virtualbox node-2

ManagerIP=`docker-machine ip node-1`

docker-machine ssh node-1 docker swarm init --advertise-addr ${ManagerIP}

WorkerToken=`docker-machine ssh node-1 docker swarm join-token worker | grep token | awk '{ print $2 }'`

docker-machine ssh node-2 "docker swarm join --token ${WorkerToken} ${ManagerIP}:2377 --advertise-addr $(docker-machine ip node-2)"

Then, I created an overlay network:

eval "$(docker-machine env node-1)"
docker network create -d overlay frontend

Then, I created 4 services

docker service create \
    --name s1 \
    --constraint 'node.hostname == node-1' \
    --network frontend \
    nginx:latest

docker service create \
    --name s2 \
    --constraint 'node.hostname == node-2' \
    --network frontend \
    nginx:latest

docker service create \
    --name s3 \
    --constraint 'node.hostname == node-1' \
    --network frontend \
    --endpoint-mode dnsrr \
    nginx:latest

docker service create \
    --name s4 \
    --constraint 'node.hostname == node-2' \
    --network frontend \
    --endpoint-mode dnsrr \
    nginx:latest

s1 and s2 are --endpoint-mode=vip by default,
s3 and s4 are specified --endpoint-mode=dnsrr.

As the constraints setting, s1 and s3 will run on node-1, and s2 and s4 will run on node-2.

Then, ping test matrix are:

s1 s2 s3 s4
s1 ok x ok ok
s2 x ok ok ok
s3 ok x ok ok
s4 x ok ok ok

All vips acrossed multi-host are not pingable.

For the failed pings, it returned the error Destination Host Unreachable, such as,

root@ab79b97007a6:/# ping s1
PING s1 (10.0.0.2): 56 data bytes
92 bytes from ab79b97007a6 (10.0.0.7): Destination Host Unreachable
92 bytes from ab79b97007a6 (10.0.0.7): Destination Host Unreachable
92 bytes from ab79b97007a6 (10.0.0.7): Destination Host Unreachable
^C--- s1 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss

I tried the command ping tasks.{service-name} mentioned in #24201, it's pingable in all cases.

Metadata

Metadata

Assignees

Labels

area/networkingNetworkingarea/swarmkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.priority/P3Best effort: those are nice to have / minor issues.version/1.12

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions