Technotes

Technotes for future me

Kubernetes pvc deleting stuck in Terminating state

Please try to troubleshoot and delete remaining resources. Do not force removals unless you know what you are doing. See: https://access.redhat.com/solutions/4165791
https://cloud.redhat.com/blog/the-hidden-dangers-of-terminating-namespaces
https://technotes.adelerhof.eu/containers/kubernetes/kubernetes_namespace_deleting_stuck_in_terminating_state/

This usually happens because something is preventing a resource from being deleted, causing namespace deletion to be stuck. It is necessary to troubleshoot which resources are failing to be deleted and why.

Cause

PVC is probably still attached to node in cluster, check with:

kubectl get volumeattachment

Forcing a Deletion of a Namespace

Patch the PVC to set the “finalizers” setting to null, this allows the final unmount from the node, and the PVC can be deleted.

kubectl patch pvc {PVC_NAME} -p '{"metadata":{"finalizers":null}}'

Source:
https://veducate.co.uk/kubernetes-pvc-terminating/

Last updated on 17 Sep 2021
Published on 31 Aug 2021
Edit on GitHub