Kuberenetes Storageclass allowvolumeexpansion How it resize will work with PV PVC Pod

Viewed 1105

When creating PVC with storage class as allowvolumeexpansion: true in k8s, how will it work with a Pod?

When creating 10 Gb later and trying to extend the PVC with 15 Gb, how will it work along with component PV PVC Pod in real-time? Since when I am trying with a PVC, it is not extended as expected.

Could you help me to identify the logic behind this? Because the docs refer to extending the PVC. But I am not sure how is it applicable to the PV (source).

1 Answers

Welcome to the community!

Feature allowVolumeExpansion was introduced in kubernetes 1.11 version and it works only with specific volume types.

Types of volumes supported:

  • gcePersistentDisk
  • awsElasticBlockStore
  • Cinder
  • glusterfs
  • rbd
  • Azure File
  • Azure Disk
  • Portworx
  • FlexVolumes
  • CSI

(This can be found here - Allow Volume Expansion)

As you mentioned storage class should have this field set to true, once this is done, Persistent Volume Claim will trigger the volume expansion.

How this works in practice. Once you corrected PVC to increase a volume size, it will be reflected within your PVC and new condition FileSystemResizePendingwill be added. You can check it with

kubectl get pvc <your_pvc_name> -o yaml

To get PV size actually changed, pod restart is required. This can be achieved by deleting the pod or triggering scaling down and up in your deployment.

All related details you can find here: Resizing Persistent Volumes using Kubernetes

Related