查看现有状态
[root@master ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION master NotReady control-plane 72s v1.25.0 node1 NotReady <none> 11s v1.25.0 node2 NotReady <none> 7s v1.25.0
一、驱逐节点
[root@master ~]# kubectl cordon node1 node/node1 cordoned [root@master ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION master NotReady control-plane 7m4s v1.25.0 node1 NotReady,SchedulingDisabled <none> 6m3s v1.25.0 node2 NotReady <none> 5m59s v1.25.0
二、删除该节点
[root@master ~]# kubectl delete node node1 node "node1" deleted [root@master ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION master NotReady control-plane 7m13s v1.25.0 node2 NotReady <none> 6m8s v1.25.0
三、若需要重新部署该节点
- 在该节点上执行kubeadm reset
[root@node1 ~]# kubeadm reset W1123 18:03:42.930664 15464 preflight.go:55] [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted. [reset] Are you sure you want to proceed? [y/N]: y W1123 18:03:45.173129 15464 removeetcdmember.go:85] [reset] No kubeadm config, using etcd pod spec to get data directory [reset] No etcd config found. Assuming external etcd [reset] Please, manually reset etcd to prevent further issues [reset] Stopping the kubelet service [reset] Unmounting mounted directories in "/var/lib/kubelet" [reset] Deleting contents of directories: [/etc/kubernetes/manifests /etc/kubernetes/pki] [reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf] [reset] Deleting contents of stateful directories: [/var/lib/kubelet] The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d The reset process does not reset or clean up iptables rules or IPVS tables. If you wish to reset iptables, you must do so manually by using the "iptables" command. If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar) to reset your system's IPVS tables. The reset process does not clean your kubeconfig files and you must remove them manually. Please, check the contents of the $HOME/.kube/config file.
四、设置节点为不可调度
[root@master ~]# kubectl drain 【节点名】 --ignore-daemonsets
标签:node,reset,NotReady,etc,master,v1.25,node1,k8s,节点 From: https://www.cnblogs.com/yangzp/p/16919346.html