grizzthedj
grizzthedj

Reputation: 7505

Cannot delete failed pod in Kubernetes Dashboard

I'm trying to delete a failed pod from the Pods page on the Kubernetes Web UI, but it is not getting deleted.

I understand what the error itself is, and I believe I have resolved it by using secrets, since this is a private repo. That said, I cannot re-add the pod again correctly, since it already exists.

Here is what I am seeing on the Pods page in the Kubernetes UI:

Pod Status: Waiting: ContainerCreating

Error:

Failed to pull image "<USERNAME>/<REPO>:<TAG>": 
failed to run [fetch --no-store docker://<USERNAME>/<REPO>:<TAG>]: 
exit status 254 stdout: stderr: Flag --no-store has been deprecated, 
please use --pull-policy=update fetch: Unexpected HTTP code: 401, URL: https://xxxxxx.docker.io/v2/<USERNAME>/<NAMESPACE>/manifests/<TAG>
    Error syncing pod

I have also tried deleting the pod with kubectl, but kubectl can't even see the failed pod!

$ kubectl get pods
No resources found
$ kubectl get pods --show-all
No resources found

Is there any other way that I can delete this pod?

Upvotes: 1

Views: 3600

Answers (2)

grizzthedj
grizzthedj

Reputation: 7505

I just found a solution to my own problem. Go to the Workloads page in the Kubernetes Web UI, and delete the associated Deployment, and the Pod will be deleted as well.

If the pod does not get deleted after this, you will need to force a delete from the command line.

kubectl delete pod <POD_NAME> --grace-period=0 --force

Upvotes: 3

Mohammad Asif
Mohammad Asif

Reputation: 21

Use command below to delete terminated or failed one:

kubectl delete pods pod_name --grace-period=0 --force -n namespace_name

Upvotes: 2

Related Questions