设置节点不可用
重新调度该节点上所有的pod
[rancher@rmaster01 ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
node01 Ready worker 23d v1.19.8
node02 Ready worker 23d v1.19.8
rmaster01 Ready controlplane,etcd 23d v1.19.8
rmaster02 Ready controlplane,etcd 23d v1.19.8
rmaster03 Ready controlplane,etcd 23d v1.19.8
[rancher@rmaster01 ~]$ kubectl cordon rmaster01
node/rmaster01 cordoned
[rancher@rmaster01 ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
node01 Ready worker 23d v1.19.8
node02 Ready worker 23d v1.19.8
rmaster01 Ready,SchedulingDisabled controlplane,etcd 23d v1.19.8
rmaster02 Ready controlplane,etcd 23d v1.19.8
rmaster03 Ready controlplane,etcd 23d v1.19.8
[rancher@rmaster01 ~]$ kubectl drain rmaster01 --ignore-daemonsets --delete-local-data --force
node/rmaster01 already cordoned
WARNING: ignoring DaemonSet-managed Pods: cattle-prometheus/exporter-node-cluster-monitoring-msmqz, cattle-system/cattle-node-agent-8rdtr, kube-system/canal-wczbn
evicting pod kube-system/rke-network-plugin-deploy-job-tpt48
evicting pod kube-system/rke-coredns-addon-deploy-job-snjhp
evicting pod kube-system/rke-ingress-controller-deploy-job-2fvsw
evicting pod kube-system/rke-metrics-addon-deploy-job-8drtr
pod/rke-metrics-addon-deploy-job-8drtr evicted
pod/rke-ingress-controller-deploy-job-2fvsw evicted
pod/rke-coredns-addon-deploy-job-snjhp evicted
pod/rke-network-plugin-deploy-job-tpt48 evicted
node/rmaster01 evicted