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 th
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.
If a pod is recreated even after kubectl delete pod-name
, it means that the pod is controlled by a higher level kubernetes objects such as Deployment, Replicaset, Replication controller.
You can use kubectl describe pods pod-name | grep Controllers
to find which controller your pod belongs to. You need to delete this higher level object to delete the pod.