HOWTO - Increase Volume Size
As an operator, I may need to resize a volume. This document describes how to resize the usage of user volumes, group volumes, and PV data volumes.
Caution: The volume size can only be increased and cannot be rolled back after resizing.
Prerequisites
- Can access your Kubernetes cluster by - kubectl
- Basic understanding of kuberentes storage classes, PersistentVolume (PV) , and PersistentVolumeClaim (PVC). 
- Your storage class can enforce storage size. If you use local storage or NFS client as storage, the volume size cannot be enforced. To resize volume is even not applicable. 
- The storage class of your PVC allows volume expansion. You can check by the following command. - $ kubectl get storageclass NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE gp2 (default) kubernetes.io/aws-ebs Delete WaitForFirstConsumer true 104d- For more information, please see Resizing Persistent Volumes using Kubernetes 
Resize User Volume
- Find the PVC of the user volume - claim-<username>.- $ kubectl -n hub get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE claim-phadmin Bound pvc-86331a97-b736-490c-be72-7ef5c6cad47a 20Gi RWO gp2 102d
- Check if the storage class of the PVC allows volume expansion - $ kubectl get storageclass <storage-class> NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE gp2 (default) kubernetes.io/aws-ebs Delete WaitForFirstConsumer true 104d
- Resize the PVC by the following command - kubectl -n hub patch pvc claim-<username> -p '{"spec":{"resources":{"requests":{"storage":"40Gi"}}}}}'
Resize Group Volume
- Find the PVC named - project-<group>. If the storage class of the PVC is not empty, go to step 2 to resize this PVC.- $ kubectl -n hub get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE project-phusers Bound pvc-0c62598b-c9fe-49d4-910f-b0c7f6269636 1Gi RWX efs 74d- Otherwise, the PVC is binding an NFS PV pointing to an NFS server. Please find the PVC named - data-nfs-project-<group>-0, which is the backed PVC for the NFS server.- $ kubectl -n hub get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE project-phusers Bound hub-nfs-project-phusers 1Gi RWX 74d data-nfs-project-phusers-0 Bound pvc-0c62598b-c9fe-49d4-910f-b0c7f6269636 1Gi RWO gp2 74d
- Check if the storage class of the PVC allows volume expansion - $ kubectl get storageclass <storageclass> NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE gp2 (default) kubernetes.io/aws-ebs Delete WaitForFirstConsumer true 104d
- Resize the PVC by the following command - kubectl -n hub patch pvc <pvcname> -p '{"spec":{"resources":{"requests":{"storage":"50Gi"}}}}}'
Resize PV data volume
- Find the PVC named - dataset-<dataset>. If the storage class of the PVC is not empty, go to step 2 to resize this PVC.- $ kubectl -n hub get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE dataset-test Bound pvc-0c62598b-c9fe-49d4-910f-b0c7f6269636 1Gi RWX efs 74d- Otherwise, the PVC is binding an NFS PV pointing to an NFS server. Please find the PVC named - data-nfs-dataset-<dataset>-0, which is the backed PVC for the NFS server.- $ kubectl -n hub get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE dataset-test Bound hub-nfs-project-phusers 1Gi RWX 74d data-nfs-dataset-test-0 Bound pvc-0c62598b-c9fe-49d4-910f-b0c7f6269636 1Gi RWO gp2 74d
- Check if the storage class of the PVC allows volume expansion - $ kubectl get storageclass <storageclass> NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE gp2 (default) kubernetes.io/aws-ebs Delete WaitForFirstConsumer true 104d
- Resize the PVC by the following command - kubectl -n hub patch pvc <pvcname> -p '{"spec":{"resources":{"requests":{"storage":"50Gi"}}}}}'
