Kubernetes集群中移除Node

在master节点上执行:

kubectl drain swarm1 --delete-local-data --force --ignore-daemonsets
kubectl delete node swarm1


在node2上执行:

kubeadm reset



实例操作:



[root@compass-control-master3]:~# kubectl get node
NAME STATUS ROLES AGE VERSION
kube-master-1 Ready <none> 171d v1.10.6
kube-master-2 Ready <none> 171d v1.10.6
kube-master-3 Ready <none> 171d v1.10.6
kube-node-1 Ready <none> 171d v1.10.6
kube-node-192-168-0-213 Ready <none> 2m v1.10.6
kube-node-2 Ready <none> 171d v1.10.6
[root@compass-control-master3]:~#
[root@compass-control-master3]:~# kubectl delete node kube-node-2
node "kube-node-2" deleted
[root@compass-control-master3]:~# kubectl get node
NAME STATUS ROLES AGE VERSION
kube-master-1 Ready <none> 171d v1.10.6
kube-master-2 Ready <none> 171d v1.10.6
kube-master-3 Ready <none> 171d v1.10.6
kube-node-1 Ready <none> 171d v1.10.6
kube-node-192-168-0-213 Ready <none> 4m v1.10.6