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 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.
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 reflecting the new capacity.
#
Current Limitations and Known BehaviorCurrently, a volume that has a snapshot present on the system, or the volume is a restore volume (i.e. created from a snapshot), the resize is disallowed.
For 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 filesystem isn’t yet expanded. Depending on the application behaviour, If at all this happens, restarting the application pod should mitigate this.