Interview Prep/Kubernetes/Storage and volumes

`kubectl edit pvc data` to grow from 50Gi to 100Gi fails with `persistentvolumeclaims "data" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize`.

BeginnerTroubleshootingStorage and volumes
Answer

Likely causes → The StorageClass does not have allowVolumeExpansion: true, or the PV was statically created.

Diagnose →

kubectl get sc gp3 -o jsonpath='{.allowVolumeExpansion}{"\n"}'

Fix → Enable expansion on the class (that field is mutable), then patch the PVC:

kubectl patch sc gp3 -p '{"allowVolumeExpansion": true}'
kubectl patch pvc data -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'

Watch for the FileSystemResizePending condition; modern CSI drivers grow the filesystem online.

Prevent → Create every StorageClass with allowVolumeExpansion: true.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Storage and volumes