Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 79/ 160
04. Storage & Persistent Data

Handling PVC Stuck in Pending or Terminating States

Unstick PVCs pending provision or stuck terminating due to finalizers and mounts.

IntermediatePending PVC · Terminating · Finalizers3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A PVC pending at the loading dock lacks a matched truck, whereas a terminating one is waiting for every forklift and manifest copy to release it. The simple Kubernetes rule is: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Think of it like…

A PVC pending at the loading dock lacks a matched truck, whereas a terminating one is waiting for every forklift and manifest copy to release it.

Where you’ve seen it

Before approving a data-path change, the storage owner runs kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data. Expected evidence: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events. If the run instead shows this symptom, stop and restore the last known state: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.

Words you’ll hear

Pending PVC
For this lesson, Pending PVC is the controlling idea: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
Terminating
Terminating is the checkpoint; run kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data and inspect the owner chain. Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.
Finalizers
Finalizers is the outcome to preserve; the cost is explicit: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.
Verification evidence
The evidence command is kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data. It connects the declaration to this behavior: Unstick PVCs pending provision or stuck terminating due to finalizers and mounts.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Pending PVC reaches the intended state

Unstick PVCs pending provision or stuck terminating due to finalizers and mounts. Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

The concrete checkpoint is kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data; compare the Pending PVC owner, Terminating state, and Finalizers outcome instead of treating YAML acceptance as proof.

Verify Terminating, not only object creation

Run kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data after the change and correlate the result with Events and the owning object. Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Key takeaway: Pending PVC is implemented only when this invariant remains observable: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Terminating: failure boundary and production cost

Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod. The prerequisite contract is concrete: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace. A safe design limits blast radius, records the last good configuration, and uses kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data as a deterministic rollback checkpoint.

Recover from Terminating drift

Capture the current state with kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.

Key takeaway: Accept the trade-off consciously: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

How it works, step by step

Step 1 of 4
Data owner

1. Declare the data contract

State capacity, topology, access, and ownership in the claim or class: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Pending PVC contract → owned state
Key numbers at this step
Goal
Unstick PVCs pending provision or stuck terminating due to finalizers and mounts.
Owner
Pending PVC

When to use it & trade-offs

What it is

Unstick PVCs pending provision or stuck terminating due to finalizers and mounts. Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Why it matters: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod. The invariant at risk is specific: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events. The quickest fact check before changing the design is kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data.

When to reach for it

  • Use Pending PVC to enforce this invariant: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
  • Use Terminating evidence from kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data in reviews and incident timelines. Unstick PVCs pending provision or stuck terminating due to finalizers and mounts.
  • Choose the managed external data plane route only when this cost is justified by governance or scale: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

When to avoid or be careful

  • Avoid assuming Pending PVC is complete after YAML submission; the required behavior is concrete: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
  • Avoid treating the next symptom as random; check the owner and state with kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data first: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

Native, manual, and managed paths for Pending PVC

Dynamically provisioned storage
Best for: Unstick PVCs pending provision or stuck terminating due to finalizers and mounts. A concrete incident check is kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data.

Strengths: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Watch out: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace. Recovery must also recognize this signal: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.

Manual pre-provisioning
Best for: Quickly testing the Terminating assumption with kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data; the expected invariant is: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Strengths: kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Pending PVC, it does not make this symptom self-documenting: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.

Managed external data plane
Best for: Teams that need Finalizers integrated with guardrails; the evidence path is kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.

Watch out: The added platform ownership buys value at this cost: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
  • Trace Pending PVC to Finalizers through Terminating; the invariant is: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
  • Recognize the symptom: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.
  • Justify the cost: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.
  • Verify with kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data instead of only inspecting YAML.

Benchmarks & rules of thumb

2 -
main PVC stuck states: Pending and Terminating
1 -
normal safety finalizer to inspect first for a mounted claim
0 -
finalizers should be removed before consumers are gone

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Pending PVC owner contract: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events.
  • Ignoring this telltale condition leads to unrelated changes: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod.
  • Repeating kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data without an owner for remediation wastes retry cost. Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events?
  • Which owner object, logs, and Events would you inspect for this symptom-Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod-?
  • At what threshold would this cost become unacceptable: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace?
Interview tip: Interview sequence: state the invariant, run kubectl describe pvc data; kubectl get pvc data -o jsonpath='{.metadata.finalizers}'; kubectl get pod -A --field-selector=spec.volumes.persistentVolumeClaim.claimName=data, name the failure, then justify the cost. Invariant: Pending PVC diagnosis checks StorageClass, provisioner Events, topology, quotas, and capacity; Terminating diagnosis checks consumer Pods, protection finalizers, and CSI cleanup Events. Failure: Removing pvc-protection or provider finalizers without unmounting consumers can leak the backing volume or recreate a data race with a terminating Pod. Cost: Finalizers are a safety barrier rather than clutter, but automated cleanup needs explicit timeout and owner reconciliation to avoid an unbounded Terminating namespace.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Handling PVC Stuck in Pending or Terminating States with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Storage Performance Tuning (IOPS, Throughput, Node Attachment Limits)
Next topic
Data Persistence Patterns for Vector Databases & LLM Model Weights