Expanding PersistentVolumeClaims
What you'll learn: How to resize an existing PersistentVolumeClaim to give your application more storage space without recreating volumes or losing data.
Why Volume Expansion Matters
Imagine you've rented a storage unit, but your belongings have grown beyond its capacity. Instead of moving everything to a bigger unit (recreating volumes), wouldn't it be easier if you could just expand the walls of your current one? That's exactly what PVC expansion allows in Kubernetes.
How PVC Expansion Works
Not all storage is expandable. The StorageClass must have allowVolumeExpansion: true set. When this feature is enabled, you can increase (but never decrease) the storage capacity requested in your PVC.
The process is straightforward:
- Edit your PVC's
spec.resources.requests.storagefield to a larger value - Kubernetes automatically triggers the expansion
- Depending on your volume type, you may need to restart the pod for the filesystem to recognize the new size
Example Expansion Flow
If your PVC currently requests 10Gi:
spec:
resources:
requests:
storage: 10Gi
You can update it to request more:
spec:
resources:
requests:
storage: 20Gi
Apply the change with kubectl apply or kubectl edit pvc <pvc-name>, and Kubernetes handles the underlying volume expansion automatically.
Important Limitations
- Volume expansion only works upward — you cannot shrink a PVC
- The StorageClass must support expansion
- Some volume types require pod restart for the filesystem to resize
- Check PVC status conditions to confirm successful expansion
Key Takeaway: PVC expansion lets you grow storage on-demand when your StorageClass supports allowVolumeExpansion, providing a seamless way to scale persistent storage without data migration or downtime.