← All snippets
kubernetesstoragepvcazure
Resize PVCs Dynamically in Kubernetes
Expand PersistentVolumeClaim storage on the fly without downtime — check, patch, verify.
Check if StorageClass supports expansion
kubectl get sc
# Look for ALLOWVOLUMEEXPANSION = true
Check current PVC size
kubectl get pvc data-loki-write-0 -n logging -o jsonpath='{.spec.resources.requests.storage}'
Patch the PVC to new size
kubectl patch pvc data-loki-write-0 -n logging \
-p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'
Verify
kubectl get pvc data-loki-write-0 -n logging
# STATUS should stay "Bound", CAPACITY should update
Gotcha
- You can only increase size, never shrink
- Azure Disk CSI: online expansion works, no pod restart needed
- If PVC shows
FileSystemResizePendingcondition, restart the pod using it - Some older provisioners require the pod to be deleted so the volume can detach, resize, and reattach
allowVolumeExpansionmust betrueon the StorageClass before you try to patch