k8s 控制器-Replicaset-Deployment
# cordon 警戒线 执行后不会在调度到该节点上了
[root@master01 deployment]# kubectl cordon node01
node/node01 cordoned
[root@master01 deployment]#
NAME STATUS ROLES AGE VERSION
master01 Ready control-plane,master 25d v1.23.1
node01 Ready,SchedulingDisabled <none> 25d v1.23.1
node02 Ready <none> 25d v1.23.1
[root@master01 deployment]# kubectl uncordon node01
node/node01 uncordoned
[root@master01 deployment]# kubectl get node
NAME STATUS ROLES AGE VERSION
master01 Ready control-plane,master 25d v1.23.1
node01 Ready <none> 25d v1.23.1
node02 Ready <none> 25d v1.23.1
#drain 排出 会驱赶节点pod
[root@master01 deployment]# kubectl drain node01 --ignore-daemonsets --delete-emptydir-data
node/node01 cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-mph7p, kube-system/kube-proxy-b8dtc, monitor-sa/node-exporter-j2f28
evicting pod kube-system/kube-state-metrics-57794dcf65-t45n5
evicting pod default/nginx-v1-86549575c9-88rz4
evicting pod cattle-fleet-system/fleet-agent-9ff5b4476-5lncn
evicting pod cattle-system/cattle-cluster-agent-659846f757-thvr4
--ignore-daemonsets --忽略守护进程 --delete-emptydir-data
kubectl drain node01 --ignore-daemonsets --delete-emptydir-data
# 恢复
[root@master01 deployment]# kubectl uncordon node01
标签:cordon,node01,Replicaset,kubectl,--,master01,25d,drain,deployment From: https://www.cnblogs.com/liuyoushui/p/17278682.html