Docker Community Forums

Share and learn in the Docker community.

Swarm Manager Worker Issue

swarm

(Benpetsch) #1

My setup:

  • 2 nodes on 2 diffrent machines (1 manager, 1 worker)
  • On the manager I do deploy a reverse-proxy as a container called “traefik”
  • I do deploy a whoami service, which deploys one container on each node.
  • From my traefik overview I do see the 2 containers get discovered correctly.

Problem:

Expected behaviour:

2 Nodes (2 manager)

  • From 2 curl requests “whoami .example.org” I do get two valid responses
  • 200 OK - I’m XYZ-MACHINE-1
  • 200 OK - I’m XYZ-MACHINE-2

2 Nodes (1 manager, 1 worker)

  • From 2 curl requests “whoami .example.org” I do get two valid responses
  • 200 OK - I’m XYZ-MACHINE-1
  • 200 OK - I’m XYZ-MACHINE-2

Configuration of the node as manager or worker do not change this behaviour.

Actual behaviour:

2 Nodes (2 manager)

  • From 2 curl requests “whoami .example.org” I do get two valid responses
  • 200 OK - I’m XYZ-MACHINE-1
  • 200 OK - I’m XYZ-MACHINE-2

2 Nodes (1 manager, 1 worker)

  • From 2 curl requests “whoami .example.org” I do get one valid responses and one timeout
  • 200 OK - I’m XYZ-MACHINE-1
  • 502 Bad Gateway ( the response is from the traefik reverse proxy, after loading >30sec)

Configuring the swarm with manger only nodes, everything works like a charm.
Configuring the swarm with 1 manager node and and 1 worker does not work.
Containers get deployed on the worker and Traefik detects them correctly.
But traffic won’t get routed to this container. Resulting in 502 bad gateway error message from my traefik container.

What did I try to solve my problem:

  • some googleing
  • experimenting with configuration
  • following the docker swarm base tutorial:
    I followed this tutorial (https://docs.docker.com/get-started/part4/#create-a-cluster) to setup a swarm the right way. It works like a charm. BUT. Adding another worker node to this swarm which is not “docker-machine create --driver virtualhost” bumps up another strange issue. From the first two vms 2 of the 3 whoami services can be accessed. From the host system only the container on the host can be accessed.

Please hint me towards the right direction.