Interview Prep/Kubernetes/Configuration, Secrets and storage

How can you see which pods use a PVC before deleting it?

BeginnerScenarioConfiguration, Secrets and storage
Answer

Situation read → A PVC stuck in Terminating after delete.

What I'd do →

  1. kubectl describe pvc data shows Used By
  2. kubectl get pods -A -o json | jq for claimName matching
  3. Delete or scale down the pods using it
  4. The kubernetes.io/pvc-protection finalizer clears once no pod uses it
  5. Verify with kubectl get pvc

Why → Storage protection finalizers stop in-use claims from being deleted.

Interview tip → Do not patch finalizers off before checking for users.

All Kubernetes questions Roadmap: Kubernetes core

More on Configuration, Secrets and storage