AdmissionController holding back a Terminated Pod from getting completely removed

10/29/2019

I have an AdmissionController which is running successfully and prevents some pods from getting instantiated, checking on the prescribed conditions.

But the Pod gets stuck in Terminated Status and never goes away. I also have a process that monitors for stuck pods and cleans up. It tries to delete these Terminated Pods using deleteNamespacedPod. The Api call works fine, but the Pod lingers on without getting deleted. Is the AdmissionController denial a finalizer that is holding back the Pod from getting deleted ?

When I took down the Admission Controller, the clean up process was successfully able to delete the Pod.

Any insights or things I am missing in the AdmissionController ?

I appreciate any help/insights in this issue.

Thanks a lot,

-Sreeni

-- Sreeni
kubernetes
webhooks

1 Answer

10/29/2019

Run the below command against the terminated pod to delete it forcefully

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