Just wondered if a drained manager node still participate in the described routing mesh.
Let's assume the node3
is drained. Would the service my-web.1
still be accessible via HAProxy
-> node3
-> my-web.1
?
CodePudding user response:
When a node is drained, all existing tasks run on it are stopped and are run on ACTIVE
nodes. Also, the drained node won't be able to receive new tasks from the swarm manager.
However, the drained node still participates in the routing mesh and your service my-web.1
would still be accessible from node3
.
Ref: https://docs.docker.com/engine/swarm/swarm-tutorial/drain-node/
Here is what I have done to confirm that behaviour:
- Created a service with 3 replicas for a simple flask app. I am running two nodes here.
- The tasks are distributed on the two nodes. I can access my flask app from the IP address of both nodes.
- I have set the availability of one of the nodes to
DRAIN
, and all the flask app tasks in it are stopped and created on the other active node. - I can still access the flask app from the IP address of the drain node. Also, the logs of the service show the requests coming from the IP address of the drained node.