- Set
allowVolumeExpansion
field as true in the storageclass manifest.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: azurefile-csi
provisioner: file.csi.azure.com
allowVolumeExpansion: true
parameters:
skuName: Standard_LRS
reclaimPolicy: Delete
volumeBindingMode: Immediate
- Create storageclass, pvc and pod.
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-csi.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/pvc-azurefile-csi.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/nginx-pod-azurefile.yaml
- Check the PV size
kubectl get pvc pvc-azurefile
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-azurefile Bound pvc-74dc3e29-534f-4d54-98fc-731adb46c948 15Gi RWX file.csi.azure.com 57m
- Check the filesystem size in the container.
kubectl exec -it nginx-azurefile -- df -h /mnt/azurefile
Filesystem Size Used Avail Use% Mounted on
//fuse0575b5cff3b641d7a0c.file.core.windows.net/pvc-74dc3e29-534f-4d54-98fc-731adb46c948 15G 128K 15G 1% /mnt/azurefile
- Expand the pvc by increasing the field
spec.resources.requests.storage
.
kubectl edit pvc pvc-azurefile
...
...
spec:
resources:
requests:
storage: 20Gi
...
...
- Verify the filesystem size.
kubectl get pvc pvc-azurefile
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-azurefile Bound pvc-74dc3e29-534f-4d54-98fc-731adb46c948 20Gi RWX file.csi.azure.com 65m
kubectl exec -it nginx-azurefile -- df -h /mnt/azurefile
Filesystem Size Used Avail Use% Mounted on
//fuse0575b5cff3b641d7a0c.file.core.windows.net/pvc-74dc3e29-534f-4d54-98fc-731adb46c948 20G 128K 20G 1% /mnt/azurefile