Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove NotReady nodes from kubernetes cluster automatically

Tags:

kubernetes

I'm running the kuberenets cluster on bare metal servers and my cluster nodes keep added and removed regularly. But when a node is removed, kubernetes does not remove it automatically from nodes list and kubectl get nodes keep showing NotReady nodes. Is there any automated way to achieve this? I want similar behavior for nodes as kubernetes does for pods.

like image 724
Vikram Jakhar Avatar asked Oct 27 '22 13:10

Vikram Jakhar


1 Answers

To remove a node follow the below steps

Run on Master
# kubectl cordon <node-name>
# kubectl drain <node-name> --force --ignore-daemonsets  --delete-emptydir-data
# kubectl delete node <node-name>
like image 141
P Ekambaram Avatar answered Nov 15 '22 08:11

P Ekambaram