This document describes how to dynamically resize a volume (PVC) using Kubernetes and Portworx.
- Resize support for PVC is in Kubernetes 1.11 and above. If you have an older version, use pxctl volume update to update the volume size.
- The StorageClass must have
- The PVC must be in use by a Pod.
To resize a Portworx PVC, you can simply edit the PVC spec and update the size. Let’s take an example of resizing a mysql PVC.
- Download the MySQL StorageClass spec and apply it. Note that the StorageClass has
- Download the MySQL PVC spec and apply it. We will start with a 5GB volume.
- Download the MySQL Deployment spec and apply it. Wail till the pod becomes 1/1 and then proceed to next step.
kubectl edit pvc mssql-dataand change the size in the “spec” to 10Gi.
After you save the spec,
kubectl describe pvc mssql-data should have an entry like below that confirms the volume resize.
Normal VolumeResizeSuccessful 5s volume_expand ExpandVolume succeeded for volume default/mssql-data