先drain节点上的pod
使用kubectl drain node03 --delete-local-data --force --ignore-daemonsets
之后删除node
[root@master01 ~]# kg node
NAME STATUS ROLES AGE VERSION
master01 Ready master 97d v1.18.2
master02 Ready master 97d v1.18.2
master03 Ready master 97d v1.18.2
node01 Ready <none> 97d v1.18.2
node02 Ready <none> 92d v1.18.2
node03 Ready <none> 91d v1.18.2
[root@master01 ~]# kubectl drain node03 --delete-local-data --force --ignore-daemonsets
node/node03 cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-vv7nj, kube-system/kube-proxy-gtg5v
evicting pod default/my-test01-68c4c897cb-hl2np
pod/my-test01-68c4c897cb-hl2np evicted
node/node03 evicted
[root@master01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master01 Ready master 97d v1.18.2
master02 Ready master 97d v1.18.2
master03 Ready master 97d v1.18.2
node01 Ready <none> 97d v1.18.2
node02 Ready <none> 92d v1.18.2
node03 Ready,SchedulingDisabled <none> 91d v1.18.2
[root@master01 ~]# kubectl delete node node03
node "node03" deleted
[root@master01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master01 Ready master 97d v1.18.2
master02 Ready master 97d v1.18.2
master03 Ready master 97d v1.18.2
node01 Ready <none> 97d v1.18.2
node02 Ready <none> 92d v1.18.2
[root@master01 ~]#