Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete kubernetes pods (and other resources) in the system namespace

Tags:

kubernetes

I have by mistake added a pod in the system namespace "kube-system". And then I am unable to remove this pod. It also seems to have created a replica set. Every time delete these items, they are recreated.

Can't seem to find a way to delete pods or replica sets belonging to the system namespace "kube-system"

like image 380
Santanu Dey Avatar asked Jul 08 '16 09:07

Santanu Dey


People also ask

How do I delete all resources in Kubernetes namespace?

To force delete a Kubernetes namespace, remove the finalizer from the namespace's configuration. The finalizer is a Kubernetes resource whose purpose is to prohibit the force removal of an object. The steps below demonstrate the procedure for removing the finalizer from the namespace configuration. 2.

How do I delete a pods and services in Kubernetes?

To delete the pod you have created, just run kubectl delete pod nginx . Be sure to confirm the name of the pod you want to delete before pressing Enter. If you have completed the task of deleting the pod successfully, pod nginx deleted will appear in the terminal.


1 Answers

If you created the pod using kubectl run, then you will need to delete the deployment (which created the replica set, which created the pod). Otherwise, the higher level controllers will continue to ensure that the objects they are responsible for keeping running stay around in the system, even if you try to delete them manually. Try kubectl get deployment --namespace=kube-system to see if you have a deployment in the kube-system namespace. If so, deleting it should also delete the replica set and the pods that you created.

like image 112
Robert Bailey Avatar answered Oct 14 '22 19:10

Robert Bailey