Automatic resize your kubernetes PVC with prometheus metrics
4.8K
This app is a simple process that relies on Kubernetes CSI Driver and Prometheus to automatically scale up Persistent Volume Claims.
When Kubernetes is configured to use CSI driver, CSI comes with a set of pods that helps us managing our volumes. Among others, it exposes metrics to Prometheus and also comes with an automatic way of resizing physical volumes when a persistent volume claim is modified. Here is when this app comes into play, Controlling the usage of the filesystem mounted to any given pod running on your cluster, give us metrics on Prometheus about the usage. The app regularly monitors the metric (which are configurable) waiting for a threshold to be meet and then is when it increases the PVC so that CSI Driver can later on use it expand the physical volume!
Here is a working example on how to deploy on a cluster https://github.com/cohandv/external-pvc-scaler/blob/master/k8s/install.yml
kube-system (recommended) using this template. if you want to override this, attach the config as volume at /app/config.iniThis is all the settings that support this tool
[general]
metric_type=prometheus
wait_timeout_in_seconds=1
threshold=60
operator=<
increase_multiplier=0.15
[kubernetes]
in_cluster=yes
dry_run=no
[log]
level=INFO
[prometheus]
url=http://prometheus:9090
query=max by (persistentvolumeclaim) (kubelet_volume_stats_available_bytes)*100/max by (persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes)
entity=persistentvolumeclaim
/app/config.ini otherwise will take the default values in the default.ini fileThis is a working prototype that is being tested on Kubernetes EKS 1.8 with CSI Driver installed, kubernetets manifests are on github, help is appretiated!!!
Repository: https://github.com/cohandv/external-pvc-scaler
Content type
Image
Digest
Size
335 MB
Last updated
over 5 years ago
docker pull cohandv/external-k8s-pvc-resizer