docker node rm节点报错node ... ... is not down and can't be removed 问题的处理技巧


尝试将某个worker节点移除swarm集群,可是,报错了:

 

[root@nccztsjb-node-07 ~]# docker node rm cw5bome4a9g1rzelivxejd31c
Error response from daemon: rpc error: code = FailedPrecondition desc = node cw5bome4a9g1rzelivxejd31c is not down and can't be removed
 

 

面对错误,挡得住你吗?当然不能

 

以为是节点没有处于Drain状态,所以,先更新节点状态

 

[root@nccztsjb-node-07 ~]# docker node update --availability drain cw5bome4a9g1rzelivxejd31c
cw5bome4a9g1rzelivxejd31c

 

 

再次尝试移除,依然报错。

 

还咋搞?看看别人咋搞。还有没有别的办法:

 

将该节点移除swarm集群。

 

1、登录到这个要被移除的节点上

2、执行如下的命令

[root@nccztsjb-node-10 ~]# docker swarm leave
Node left the swarm.
[root@nccztsjb-node-10 ~]# 

 

那么,这个节点,就会离开swarm集群

 

完事了吗,回到manager节点

 

[root@nccztsjb-node-07 ~]# docker node ls
ID                            HOSTNAME           STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
mjktd9is5xd8d4el2awrqby5k *   nccztsjb-node-07   Ready     Active         Leader           20.10.17
u87i9artgcnyki0osp9gvylu3     nccztsjb-node-08   Ready     Active                          20.10.17
z1x3ufsdxekrt6w5n37m7azfe     nccztsjb-node-09   Ready     Active                          20.10.17
cw5bome4a9g1rzelivxejd31c     nccztsjb-node-10   Down      Drain                           20.10.17

 

 

还可以看到这个节点,再试试,rm

 

[root@nccztsjb-node-07 ~]# docker node rm cw5bome4a9g1rzelivxejd31c
cw5bome4a9g1rzelivxejd31c
[root@nccztsjb-node-07 ~]# docker node ls
ID                            HOSTNAME           STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
mjktd9is5xd8d4el2awrqby5k *   nccztsjb-node-07   Ready     Active         Leader           20.10.17
u87i9artgcnyki0osp9gvylu3     nccztsjb-node-08   Ready     Active                          20.10.17
z1x3ufsdxekrt6w5n37m7azfe     nccztsjb-node-09   Ready     Active                          20.10.17
[root@nccztsjb-node-07 ~]# 

 

 

如你所见,搞定了!开心伐?

posted @ 2022-09-02 14:12  Zhai_David  阅读(633)  评论(0编辑  收藏  举报