Jethro
Jethro

Reputation: 3369

Automatically resize/grow a kubernetes PVC

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?

Upvotes: 1

Views: 9682

Answers (3)

Farley
Farley

Reputation: 1498

This is possible with an controller called the Kubernetes Volume Autoscaler. This will require that you have defined your StorageClasses with the flag of allowVolumeExpansion enabled and that you have Prometheus installed. It will also require that your disk controller supports hot-expansion, and your cloud provider supports it. See the README on this repo for more information on this.

I can confirm this tool works perfectly on both AWS and Google Cloud's Kubernetes clusters.

Disclaimer: I authored this, but it is open source and now has a handful of contributors.

Upvotes: 3

yogesh kunjir
yogesh kunjir

Reputation: 284

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.

Upvotes: 1

P Ekambaram
P Ekambaram

Reputation: 17689

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/

Upvotes: 1

Related Questions