Resize
The Volume Resize feature allows Kubernetes (or any other CO) end-users to expand a persistent volume (PV) after creation by resizing a dynamically provisioned persistent volume claim (PVC). This is allowed only if the StorageClass
has allowVolumeExpansion
boolean flag set to true. The end-users can edit the allowVolumeExpansion
boolean flag in Kubernetes StorageClass
to toggle the permission for PVC resizing. This is useful for users to optimise their provisioned space and not have to worry about pre-planning the future capacity requirements. The users can provision a volume with just about the right size based on current usage and trends, and in the future, if the need arises to have more capacity in the same volume, the volume can be easily expanded.
The Replicated PV Mayastor CSI plugin provides the ability to expand volume in the ONLINE and OFFLINE states.
#
PrerequisitesOnly dynamically provisioned PVCs can be resized.
Only volume size expansion is allowed, shrinking a volume is not allowed.
The
StorageClass
that provisions the PVC must support resize. TheallowVolumeExpansion
flag is set to true by default in the Replicated PV MayastorStorageClass
since version 2.6.0.The disk pools hosting volume replicas have sufficient capacity for volume expansion.
All the replicas of the volume are Online.
Example
- Ensure that the storage class is allowing volume expansion.
- Create a PVC.
Start an application pod that uses this PVC.
Edit the PVC to expand.
- The PV should get resized and reflect the new capacity.
#
Current Limitations and Known BehaviorFor OFFLINE volume expansion of filesystem-mode volumes, the filesystem is expanded when the application pod starts up and publishes the volume again. In the sequence of events, the CSI request to expand the filesystem on node (NodeExpandVolume) arrives about a second after the CSI request to publish the volume on node (NodePublishVolume). If within that small window application tries to fetch/check the filesystem size, it’ll see the old size of volume because the filesystem is not yet expanded. Depending on the application behaviour, If at all this happens, restarting the application pod should mitigate this.
important
If a volume is expanded during an upgrade and the IO engine is still outdated and lacks the necessary fix to handle IO on an expanded volume, the IO on the expanded range may fail. To prevent this scenario, it is recommended to wait until the upgrade is complete before attempting to expand the volumes.