Resize Kubernetes volumes automatically, without editing PersistentVolumeClaim (PVC)
Here's how to automate the scaling of Kubernetes volumes, saving the cost of unused capacity and reducing the risk of outages.
For some time, Kubernetes has supported volume auto-scaling. Although this is useful, it still requires manual editing of the requested volume size on your PV/PVC (see more about Persistent Volumes here). I dreamed for a long time of a tool to take over this manual process and when my searching continued to turn up no results, I built my own.
The Kubernetes Volume Autoscaler controller can automatically expand volumes (aka, disks) as they fill up with the help of Prometheus. When using this on one of the major cloud providers which can automatically hot-resize disks, this helps minimize cost and prevents potential outages of your services from full disks.
This is especially useful with things such as Prometheus, SQL, Kafka, Redis, Rabbit MQ and so on which slowly increase their disk usage over time.
The Kubernetes Volume Autoscaler:
- Has sane defaults, and allows overriding per-PVC these settings with annotations
- Has a sexy and easy-to-use Helm chart to easily deploy
- Has built-in Slack integration to notify when it scaled things
- Generates Kubernetes events, behaving like a "good controller" does
This is an open-source project with updates being made since initial release in Jan 2022, and I welcome contributions and feedback from the community. I've successfully used this to reduce my day-to-day tasks for a number of clients and so freed up more time. Isn't it amazing how little you have to do as DevOps nowadays when you set up the right tools?
Full pre-requisites and installation via Helm or kubectl are documented within the repo: