1. Executive Summary
Kubernetes supports in-place volume expansion, allowing you to increase the size of an existing Persistent Volume without data loss.
- The block storage is expanded at the infrastructure layer (CloudPE).
- The filesystem is then resized to utilize the new capacity.
- β Existing data remains intact β no deletion, movement, or modification occurs.
2. Prerequisites
Before starting the expansion process, ensure the following:
π§ Storage Configuration
The StorageClass must have:
allowVolumeExpansion: true
π Expansion Direction
- Only volume expansion is supported
- Example: 5Gi β 10Gi β
- Shrinking volumes β (not supported and will fail validation)
π Driver Status
- Ensure the CSI driver is running:
kubectl get pods -n kube-system | grep cinder
- All
cinder.csi.openstack.orgpods should be in Running state
3. Expansion Procedure (Declarative Method)
This method follows Infrastructure as Code (IaC) best practices using YAML manifests.
πΉ Phase A: Update the PVC Request
- Open your PersistentVolumeClaim file (e.g.,
pvc.yaml) - Update the storage size:
spec:
resources:
requests:
storage: 10Gi # Updated from 5Gi
- Apply the changes:
kubectl apply -f pvc.yaml
πΉ Phase B: Resize the Filesystem
After expanding the volume, the filesystem must be resized.
β οΈ In this environment (ext4/xfs), this requires a pod restart
If using a Deployment:
kubectl rollout restart deployment <deployment-name>
If using a Standalone Pod:
kubectl apply -f pod.yml
Kubernetes will:
- Re-attach the expanded volume
- Automatically grow the filesystem during mount
4. Post-Expansion Validation
Verify that the expansion was successful:
β Check PVC Status
kubectl get pvc <pvc-name>
- Status should be Bound
- New size should be reflected
β Verify Inside the Pod
kubectl exec <pod-name> -- df -h /data
- Confirm the updated storage size in the Size column
5. Safety & Recovery
π Data Integrity
- Expansion occurs at the end of the partition
- Existing data remains untouched and safe
β οΈ Failure Handling
- If expansion fails (e.g., insufficient quota):
- PVC status will remain:
Expanding - Pod continues operating with the original size
- PVC status will remain:
- Once the issue is resolved, expansion resumes automatically
π Best Practice
- Perform volume expansion during low-traffic periods
- This minimizes impact from required pod restarts
β Summary
- Safe, in-place volume expansion is supported
- Requires:
- StorageClass configuration
- YAML update
- Pod restart
- Always validate after expansion