0

PODs could not be deleted:

kubectl get all

NAME              READY   STATUS        RESTARTS   AGE
pod/mycluster-0   0/2     Terminating   0          15h
pod/mycluster-1   0/2     Terminating   0          15h
pod/mycluster-2   0/2     Terminating   0          15h

kubectl delete --force --all pods

Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "mycluster-0" force deleted
pod "mycluster-1" force deleted
pod "mycluster-2" force deleted

kubectl get all

NAME              READY   STATUS        RESTARTS   AGE
pod/mycluster-0   0/2     Terminating   0          16h
pod/mycluster-1   0/2     Terminating   0          16h
pod/mycluster-2   0/2     Terminating   0          16h

Terminating, not terminated.

eastwater
  • 111
  • 2

1 Answers1

0

To clean the pods you need to delete their deployments namespace.

First discover the existing deployments by running the below command:

$ kubectl get deployments --all-namespaces 

Delete the deployment by running:

$ kubectl delete deployment <NAME>

Then all corresponding pods of deployment will terminate by itself.

You can also try removing the finalizers in the pod by running below command:

kubectl patch pod <pod-name> -p '{"metadata":{"finalizers":null}}'

This syntax is used to terminate the pod that is stuck in your case.