• notice
  • Congratulations on the launch of the Sought Tech site

Docker swarm delete node rejoin

Get node information

docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
j52o5frhmphiksqz0xq1mkbbh *   node1               Ready               Active              Leader              18.09.7
nq6v8dog0xzgpzx51x7bv59bp     node2               Ready               Active                                  18.09.7
6whtoqrhkzv3ax4xy9ab20gmy     node3               Ready               Active                                  18.09.7

Let node3 go away, drain node3's container (operating on master)

docker node update --availability drain 6whtoqrhkzv3ax4xy9ab20gmy

Let node3 actively leave the cluster and leave the node in the down state (operating on node3)

docker swarm leave

Delete node node (operate on master)

docker node rm 6whtoqrhkzv3ax4xy9ab20gmy

add delete node

[root@k8s-node1 ~]#  docker swarm join     --token SWMTKN-1-1f349i4b2etn0ods4l2q03dcr2l25qdmb5u9472uv2s015i9pr-1mum48hmekeqgbs55lbh536ql     10.0.23.156:2377
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

The error is that the node was deleted before, and the rm did not perform emptying and braking to leave.

Solution:

Execute on the node to be joined
[root@k8s-node1 ~]# docker swarm leave
Node left the swarm.

Join the cluster while executing

[root@k8s-node1 ~]# docker swarm join     --token SWMTKN-1-1f349i4b2etn0ods4l2q03dcr2l25qdmb5u9472uv2s015i9pr-1mum48hmekeqgbs55lbh536ql     10.0.23.156:2377
This node joined a swarm as a manager.

You can see it by executing it on the master

If the token is forgotten, you can perform the acquisition of the token (operation on the master)

[root@k8s-master1 ]# docker swarm join-token manager 
To add a manager to this swarm, run the following command:

   docker swarm join \
   --token SWMTKN-1-1f349i4b2etn0ods4l2q03dcr2l25qdmb5u9472uv2s015i9pr-1mum48hmekeqgbs55lbh536ql \
   10.0.23.156:2377

 


Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+