What is the best way to remove and then re-add a node in a Docker Swarm cluster?


#1

Specifically we want to remove a node from cluster and re-add it back in.


#2

If the node you want to remove is still up, ssh into that node and leave the Swarm by running the following:

docker swarm leave

On the master node take note of the node id that left the swarm (docker node ls) and remove the node by running the following:

docker node rm <id of the node>

Finally you can join your new node by visiting the cluster page and clicking the "Add Node" button to obtain the node join script. https://help.replicated.com/docs/swarm/customer-installations/add-nodes/