kubernetes: Pod wont delete

I created a temporary pod to check env variables being injected.

kubectl run -i --tty busybox --image=busybox --restart=Never -- sh

After I was done, exited via exit. I then checked pods.

kubectl get pods

The pod was still listed. I tried to remove it.

kubectl delete pod ...

The busybox pod restarted with a new ID instantly. There is no Replication Controller either. How do I remove this pod?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

What worked for me was first discovering that deployments existed.

kubectl get deployments --all-namespaces

…and then deleting them kubectl delete deployment <NAME>

this command worked for me: ./kubectl get replicationcontroller ./kubectl delete replicationcontroller “name”

kubectl now creates a “Deployment” object. You’ll need to delete that. See http://kubernetes.io/docs/user-guide/simple-nginx/ for an example.

Not sure if this will help anyone, but I had pods left over from a failed job. Deleting the pod would simply restart the job, which would fail again. I had to delete the job.

kubectl get jobs

kubectl delete job <job-name>

Labels: controller-uid=ace80f91-22c7-11e6-9b20-0cc47a205c08,job-name=centos7,run=centos7

Try kubectl get jobs --all-namespaces User guide for jobs: http://kubernetes.io/docs/user-guide/jobs/

@clanstyles I meant kubectl get rs. It’s “rs” for the ReplicaSet 😃

centos7 seems to be a different issue. Can you post the output of kubectl describe pod centos7-o8msd? My guess is that it’s stuck at pulling the image. To force delete it, you can run kubectl delete pod --grace-period=0 centos7-o8msd

What does kubectl get rs --all-namespaces return?

Did both of these pods get recreated when you tried deleting them?