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 63/ 160
04. Storage & Persistent Data

PersistentVolumes (PV) & PersistentVolumeClaims (PVC)

Separate storage provisioning (PV) from consumer requests (PVC) in the binding model.

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

In plain words

A PV is the registered warehouse, and a PVC is a tenant's capacity request that is matched to one compatible unit. The simple Kubernetes rule is: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Think of it like…

A PV is the registered warehouse, and a PVC is a tenant's capacity request that is matched to one compatible unit.

Where you’ve seen it

Before approving a data-path change, the storage owner runs kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod. Expected evidence: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode. If the run instead shows this symptom, stop and restore the last known state: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.

Words you’ll hear

PV
For this lesson, PV is the controlling idea: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
PVC
PVC is the checkpoint; run kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod and inspect the owner chain. A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.
Binding
Binding is the outcome to preserve; the cost is explicit: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.
Verification evidence
The evidence command is kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod. It connects the declaration to this behavior: Separate storage provisioning (PV) from consumer requests (PVC) in the binding model.

Visual diagram

Loading interactive diagram

Theory & deep dive

How PV reaches the intended state

Separate storage provisioning (PV) from consumer requests (PVC) in the binding model. A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

The concrete checkpoint is kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod; compare the PV owner, PVC state, and Binding outcome instead of treating YAML acceptance as proof.

Verify PVC, not only object creation

Run kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod after the change and correlate the result with Events and the owning object. A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Key takeaway: PV is implemented only when this invariant remains observable: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

PVC: failure boundary and production cost

A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity. The prerequisite contract is concrete: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time. A safe design limits blast radius, records the last good configuration, and uses kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod as a deterministic rollback checkpoint.

Recover from PVC drift

Capture the current state with kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.

Key takeaway: Accept the trade-off consciously: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

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: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

PV contract → owned state
Key numbers at this step
Goal
Separate storage provisioning (PV) from consumer requests (PVC) in the binding model.
Owner
PV

When to use it & trade-offs

What it is

Separate storage provisioning (PV) from consumer requests (PVC) in the binding model. A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Why it matters: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity. The invariant at risk is specific: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode. The quickest fact check before changing the design is kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod.

When to reach for it

  • Use PV to enforce this invariant: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
  • Use PVC evidence from kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod in reviews and incident timelines. Separate storage provisioning (PV) from consumer requests (PVC) in the binding model.
  • Choose the managed external data plane route only when this cost is justified by governance or scale: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

When to avoid or be careful

  • Avoid assuming PV is complete after YAML submission; the required behavior is concrete: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod first: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

Native, manual, and managed paths for PV

Dynamically provisioned storage
Best for: Separate storage provisioning (PV) from consumer requests (PVC) in the binding model. A concrete incident check is kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod.

Strengths: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Watch out: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time. Recovery must also recognize this signal: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.

Manual pre-provisioning
Best for: Quickly testing the PVC assumption with kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod; the expected invariant is: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Strengths: kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike PV, it does not make this symptom self-documenting: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.

Managed external data plane
Best for: Teams that need Binding integrated with guardrails; the evidence path is kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.

Watch out: The added platform ownership buys value at this cost: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
  • Trace PV to Binding through PVC; the invariant is: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
  • Recognize the symptom: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.
  • Justify the cost: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.
  • Verify with kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod instead of only inspecting YAML.

Benchmarks & rules of thumb

1 -
bound PV can satisfy only one PVC claim at a time
2 -
volume modes are Filesystem and Block
0 -
Pending PVCs provide usable storage to the Pod

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the PV owner contract: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode.
  • Ignoring this telltale condition leads to unrelated changes: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity.
  • Repeating kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod without an owner for remediation wastes retry cost. Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode?
  • Which owner object, logs, and Events would you inspect for this symptom-A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity-?
  • At what threshold would this cost become unacceptable: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time?
Interview tip: Interview sequence: state the invariant, run kubectl get pv,pvc -A; kubectl describe pvc data-api-0 -n prod, name the failure, then justify the cost. Invariant: A PersistentVolume represents provisioned storage and a PersistentVolumeClaim requests capacity, access, and class; binding depends on compatible selectors and volume mode. Failure: A PVC in Pending has no matching PV or provisioner path, and a bound claim does not prove the volume can mount or the filesystem has the expected capacity. Cost: Separating capacity from workload ownership enables dynamic provisioning, but lifecycle fields, topology, and access modes must match at binding and mount time.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply PersistentVolumes (PV) & PersistentVolumeClaims (PVC) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
hostPath & Local Volumes (Use Cases & Security Risks)
Next topic
Access Modes (ReadWriteOnce, ReadWriteMany, ReadOnlyMany)