Automatically resize/grow a kubernetes PVC

11/8/2020

Is there a way to define a Persistent Volume in kubernetes which can grow automatically if it runs out of space?
If not, are there any extensions/workarounds, other than over-provisioning storage to protect our applications?

-- Jethro
kubernetes

2 Answers

11/9/2020

The storage provider should support the volume expansion.

Enable the below property in the storage class

allowVolumeExpansion: true

Edit the pvc definition and update the storage size. Kubernetes takes care of resizing the pvc volume automatically whenever the pod(s) referencing your volume are restarted.

Follow the below link for further help https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/

-- P Ekambaram
Source: StackOverflow

11/9/2020

The simple answer you can't grow a PV if that is EBS type automatically.

If you want to grow over time use EFS PV which is NFS based. For some reason you want to stick to EBS(block-based) Then you have to create a simple script that will monitor uses and if it hit specific utilization it will update PVC claim to increase volume.

-- yogesh kunjir
Source: StackOverflow