Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwarmMode - Not routing on worker node #838

Closed
WTFKr0 opened this issue Nov 14, 2016 · 5 comments
Closed

SwarmMode - Not routing on worker node #838

WTFKr0 opened this issue Nov 14, 2016 · 5 comments

Comments

@WTFKr0
Copy link
Contributor

WTFKr0 commented Nov 14, 2016

Hi,

I want to set up a 2 nodes swarm cluster (1 manager, 1 worker)
I have traefik running on master, with theses options (i took pr 728 which i found is the last with functionnal dashboard)

docker service create \
--constraint "node.role == manager" \
--name traefikswarm \
--network swarm_net \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--label "traefik.frontend.rule=Host:traefik.swarm.mydomain.org" \
--label "traefik.backend=traefikswarm" \
--label "traefik.port=81" \
-p 85:80 \
containous/traefik:pr-728 --web --retry --retry.attempts=10 --docker --docker.domain=swarm.mydomain.org --docker.swarmmode --logLevel=DEBUG --entryPoints='Name:http Address::80' --defaultEntryPoints=http --web.address=":81"

Then i run whoami service on manager node :

docker service create \
--replicas 2 \
--network swarm_net \
--name whoamiswarm \
--label "traefik.frontend.rule=Host:whoami.swarm.mydomain.org" \
--label "traefik.port=80"  \
--constraint "node.role == manager"  \
emilevauge/whoami

That's OK I can access http://whoami.swarm.mydomain.org:85/

I remove service and start same conf on worker node :

docker service create \
--replicas 2 \
--network swarm_net \
--name whoamiswarm \
--label "traefik.frontend.rule=Host:whoami.swarm.mydomain.org" \
--label "traefik.port=80"  \
--constraint "node.role == worker"  \
emilevauge/whoami

As expected the container start on worker and traefik dashboard show me an entry to the VIP, like :
http://10.0.0.7:80
But then traefik can't access it
Logs :
time="2016-11-14T09:41:21Z" level=warning msg="Error forwarding to http://10.0.0.7:80, err: dial tcp 10.0.0.7:80: getsockopt: no route to host"

What am I missing ?

Thanx for reading

@WTFKr0
Copy link
Contributor Author

WTFKr0 commented Nov 14, 2016

Some tests with 2 ubuntu containers :
I ran 2 ubuntu :

  • One in manager node, in swarm net
  • One in worker node in swarm net

They can't reach each other on the VIP
So I think it's a docker issue, not traefik
But info on that appreciated ! :D

@michaelkrog
Copy link

Have you made sure you have all the required ports open? If your overlay is encrypted you will also need to make sure you can send ESP packets.

https://docs.docker.com/engine/swarm/swarm-tutorial/#/open-ports-between-the-hosts

@WTFKr0
Copy link
Contributor Author

WTFKr0 commented Nov 16, 2016

Yeah thanks
I check all that, but I think I'm facing a NAT problem
I got Network Address Translation between hosts, so I use the "advertise-addr" to tell consul on which IP the host is joinable
That's OK for consul, but I think the network overlay on vxlan don't support that for the moment
Tring to find info on that on docker github...
Thanks

@WTFKr0
Copy link
Contributor Author

WTFKr0 commented Nov 24, 2016

After some tests, its clearly a docker swarm config issue itself. I don"t know what i'm missing.
If somebody have a docker swarm behind NAT OK, please tell me !

To reproduce my setup, it's quite easy.

  • Take 2 windows Hosts (let's say IP 192.168.1.11 a 192.168.1.12)
  • Install docker toolbox on PC 1 (internal IP 10.0.0.2-NAT and 192.168.99.100-bridge)
  • Install docker toolbox on PC 2 (internal IP 10.0.0.2-NAT and 192.168.99.100-bridge)
  • On each PC, place NAT forwarding on the swarm ports
    https://docs.docker.com/swarm/plan-for-production/#/network-access-control
    So that for example 192.168.1.11:2377/tcp redirect to VirtualBoxPC1 : 10.0.0.2:2377/TCP

Now i'm trying do do a swarm init on docker PC 1 and a swarm join on PC 2
(Have to play with --advertise-addr & --listen-addr)

Then :

  • create an overlay network
  • create service like nginx running on PC 1 on that network
  • create service like nginx running on PC 2 on that network

Try to ping/curl each other by VIP or IP

@WTFKr0
Copy link
Contributor Author

WTFKr0 commented Feb 23, 2017

Closing cause no pb with real swarm cluster
I think I got a pb with NAT and port forcarding

@WTFKr0 WTFKr0 closed this as completed Feb 23, 2017
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants