k8s剔除node节点
环境:k8s
1、查看节点找到需要剔除的节点
[root@master1 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION host-172-21-210-10 NotReady <none> 273d v1.17.2 host-172-21-210-11 Ready <none> 273d v1.17.2 host-172-21-210-12 Ready <none> 273d v1.17.2 host-172-21-210-13 Ready <none> 273d v1.17.2 host-172-21-210-14 Ready <none> 273d v1.17.2 host-172-21-210-15 Ready <none> 273d v1.17.2 host-172-21-210-17 Ready <none> 273d v1.17.2 host-172-21-210-18 Ready <none> 273d v1.17.2 host-172-21-210-8 Ready <none> 273d v1.17.2
2、建该节点上的pod进行驱逐(要删除本地的数据,有本地持久化数据的请先手动迁移)
[root@master1 ~]# kubectl drain host-172-21-210-18 --force --ignore-daemonsets --delete-local-data node/host-172-21-210-18 cordoned d4-ttdfn" evicting pod "jaeger-collector-fb95487 867" evicting pod "ums-tldxgq-854bc5d7d6-lf 658c-jx7mk" evicting pod "vsitregist-ur5nbg-784957 opin-test-6c787767evicting pod "kubesphere-router-chinapc6-jnmq4" evicting pod "etcd-598db9c7b9-st69f" q9g" evicting pod "gateway-v1-549b4fd77d-2z xnb" evicting pod "examine-v1-5bdc75b446-q4 f7847f6c-rlchf" evicting pod "ks-controller-manager-7f evicting pod "uaa-v1-54bfb44d66-l2qlt" 9z" evicting pod "uaa-jeds7v-595bfb8d8-6sq 7fb-2g4fr" evicting pod "alerting-watcher-5fcf9fb evicting pod "nacos-headless-eby8qi-0"
3、在所有节点都驱逐完成后,删除node
[root@master1 ~]# kubectl delete node host-172-21-210-18
做一个决定,并不难,难的是付诸行动,并且坚持到底。