本文主要是介绍Docker Swarm - 删除 worker 节点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、前提:集群环境已经运行
在manager节点上执行:
# 查看节点信息
>>> docker node lsID 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 update --availability active 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 lsID 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 Swarm - 删除 worker 节点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!