sam ngai
sam ngai

Reputation: 1

How to remove the pods of a removed nodes

I have removed and delete a node from k8s cluster using the following commands:

kubectl drain worker1 --ignore-daemonsets

kubectl delete worker1

After that, I saw the kube-proxy and the weave daemonset(both for worker1) still existed (it is expected since I ignored the daemonset)even the nodes is drained and deleted.

How can I remove these pods if the node(worker1) is drained and deleted?

Upvotes: 0

Views: 459

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44559

Find out the name of the pod which is scheduled on that deleted node and delete the pod using kubectl delete pods <pod_name> --grace-period=0 --force -n <namespace>

Use below command to display more details about pod including the node on which the pod is scheduled

kubectl get pods -n <namespace> -o wide

You could also use kubeadm reset on that node. Please note this will uninstall and remove all Kubernetes related software from that node.

Upvotes: 2

Related Questions