Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Volume Resizing Support

Example

  1. 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
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - mfsymlinks
  - cache=strict  # https://linux.die.net/man/8/mount.cifs
  - nosharesock  # reduce probability of reconnect race
  - actimeo=30  # reduce latency for metadata-heavy workload
  - nobrl  # disable sending byte range lock requests to the server and for applications which have challenges with posix locks
  1. 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
  1. 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
  1. 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
  1. Expand the pvc by increasing the field spec.resources.requests.storage.
kubectl edit pvc pvc-azurefile
...
...
spec:
  resources:
    requests:
      storage: 20Gi
...
...
  1. 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