Interview Prep/Kubernetes/Pods & Workloads

What are finalizers and why can an object get stuck in Terminating?

IntermediateConceptPods & Workloads
Answer

Finalizers are keys in metadata.finalizers that block actual deletion until a controller finishes cleanup and removes its key. If the controller is gone or broken, the object stays Terminating forever (common with namespaces, PVCs and CRs). Fix the controller first; only as a last resort patch out the finalizer.

kubectl patch pvc data -p '{"metadata":{"finalizers":null}}' --type=merge
All Kubernetes questions Roadmap: Kubernetes core

More on Pods & Workloads