【Docker Swarm】删除worker节点

运行环境:
Docker: 20.10.17
OS: CentOS Linux release 7.9.2009 (Core)

在manager节点上执行:

# 查看节点信息
>>> docker node ls
ID                            HOSTNAME                  STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
jr06s8pbrclkrxt7jpy7wae8t *   iZ2ze78653g20ksebnllhpZ   Ready     Active         Leader           20.10.16
4v3rwq67jrf6skao18zvjhlr0     rasp03                    Ready     Active                          20.10.17
# 排空
>>> docker node update --availability drain 4v3rwq67jrf6skao18zvjhlr0
4v3rwq67jrf6skao18zvjhlr0
>>> docker node ls
ID                            HOSTNAME                  STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
jr06s8pbrclkrxt7jpy7wae8t *   iZ2ze78653g20ksebnllhpZ   Ready     Active         Leader           20.10.16
4v3rwq67jrf6skao18zvjhlr0     rasp03                    Ready     Drain                           20.10.17

在worker节点上执行:

# 主动申请离开集群
>>> docker swarm leave
Node left the swarm.

在manager节点上执行:

>>> docker node ls
ID                            HOSTNAME                  STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
jr06s8pbrclkrxt7jpy7wae8t *   iZ2ze78653g20ksebnllhpZ   Ready     Active         Leader           20.10.16
4v3rwq67jrf6skao18zvjhlr0     rasp03                    Down      Drain                           20.10.17
# 删除节点
>>> docker node rm 4v3rwq67jrf6skao18zvjhlr0
4v3rwq67jrf6skao18zvjhlr0
>>> docker node ls
ID                            HOSTNAME                  STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
jr06s8pbrclkrxt7jpy7wae8t *   iZ2ze78653g20ksebnllhpZ   Ready     Active         Leader           20.10.16

你可能感兴趣的:(Docker,运维,docker,容器,运维,swarm)