Volume Expansion & Resizing PVCs Online
Grow PVCs online when the StorageClass and CSI driver support expansion.
In plain words
Volume expansion asks the warehouse for a larger unit before the on-site manager stretches the shelves to fill it. The simple Kubernetes rule is: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
Think of it like…
Volume expansion asks the warehouse for a larger unit before the on-site manager stretches the shelves to fill it.
Where you’ve seen it
Before approving a data-path change, the storage owner runs kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w. Expected evidence: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds. If the run instead shows this symptom, stop and restore the last known state: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
Words you’ll hear
- Expansion
- For this lesson, Expansion is the controlling idea: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- allowVolumeExpansion
- allowVolumeExpansion is the checkpoint; run
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -wand inspect the owner chain. Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path. - Resize
- Resize is the outcome to preserve; the cost is explicit: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
- Verification evidence
- The evidence command is
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w. It connects the declaration to this behavior: Grow PVCs online when the StorageClass and CSI driver support expansion.
Visual diagram
Theory & deep dive
How Expansion reaches the intended state
Grow PVCs online when the StorageClass and CSI driver support expansion. Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
The concrete checkpoint is kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w; compare the Expansion owner, allowVolumeExpansion state, and Resize outcome instead of treating YAML acceptance as proof.
Run kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w after the change and correlate the result with Events and the owning object. Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
allowVolumeExpansion: failure boundary and production cost
Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path. The prerequisite contract is concrete: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible. A safe design limits blast radius, records the last good configuration, and uses kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w as a deterministic rollback checkpoint.
Capture the current state with kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
How it works, step by step
Step 1 of 41. Declare the data contract
State capacity, topology, access, and ownership in the claim or class: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Goal
- Grow PVCs online when the StorageClass and CSI driver support expansion.
- Owner
- Expansion
When to use it & trade-offs
What it is
Grow PVCs online when the StorageClass and CSI driver support expansion. Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
Why it matters: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path. The invariant at risk is specific: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds. The quickest fact check before changing the design is kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w.
When to reach for it
- Use Expansion to enforce this invariant: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Use allowVolumeExpansion evidence from
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -win reviews and incident timelines. Grow PVCs online when the StorageClass and CSI driver support expansion. - Choose the managed external data plane route only when this cost is justified by governance or scale: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
When to avoid or be careful
- Avoid assuming Expansion is complete after YAML submission; the required behavior is concrete: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Avoid treating the next symptom as random; check the owner and state with
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -wfirst: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path. - Avoid adopting a heavier platform wrapper before measuring its cost: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
Native, manual, and managed paths for Expansion
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w.Strengths: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
Watch out: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible. Recovery must also recognize this signal: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w; the expected invariant is: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.Strengths: kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike Expansion, it does not make this symptom self-documenting: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
Watch out: The added platform ownership buys value at this cost: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Trace Expansion to Resize through allowVolumeExpansion; the invariant is: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Recognize the symptom: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
- Justify the cost: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
- Verify with kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w instead of only inspecting YAML.
Benchmarks & rules of thumb
- 1
- resize direction is growth, not generic shrink
- 2
- checks required: StorageClass permission and CSI driver support
- 0
- guaranteed no-restart filesystem growth across drivers
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the Expansion owner contract: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds.
- Ignoring this telltale condition leads to unrelated changes: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path.
- Repeating
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -wwithout an owner for remediation wastes retry cost. Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds?
- Which owner object, logs, and Events would you inspect for this symptom-Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path-?
- At what threshold would this cost become unacceptable: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible?
kubectl patch pvc data --type=merge -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'; kubectl get pvc data -w, name the failure, then justify the cost. Invariant: Online resize edits PVC requested storage upward, requires allowVolumeExpansion on the StorageClass and driver, and can finish only after filesystem or node-side resize succeeds. Failure: Claim size may change in the API while the filesystem remains old or the Pod must restart, and a driver cannot shrink an ordinary provisioned volume through this path. Cost: Online growth avoids migration but ties recovery to vendor implementation, consumes quota, and makes size increases effectively irreversible.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Volume Expansion & Resizing PVCs Online with generative AI interview Q&A and hands-on practice.