I have two machines running on Ubuntu 18.04 with Docker version 18.09.9 installed on them. I've setup a swarm cluster with the manager node advertising its public IP and the worker node advertising its private IP :
// On manager
docker swarm init --advertise-addr INSTANCE_PUBLIC_IP
// On worker
docker swarm join --advertise-addr INSTANCE_PRIVATE_IP --token XXXXXX MANAGER_PUBLIC_IP:2377
The two machines are running on the same private network and the manager is able to connect to the worker's private IP. The swarm is mostly working, I can deploy services, see the ingress network on both nodes, etc... but when I deploy a service whose container goes on the worker node, I can't reach it via the manager node. The connection times out. From the worker node, the connection succeeds.
If however I make the worker node advertise its public IP, everything works well. The nodes are hosted by Digitalocean, do you have any idea where this issue comes from ?
Related to Docker Swarm routing mesh connections time out.