Sign inSign up

cohandv/external-k8s-pvc-resizer

By cohandv

Updated over 5 years ago

Automatic resize your kubernetes PVC with prometheus metrics

Image
1

4.8K

cohandv/external-k8s-pvc-resizer repository overview

External pvc scaler

This app is a simple process that relies on Kubernetes CSI Driver and Prometheus to automatically scale up Persistent Volume Claims.

How this works

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!

Deploy

Here is a working example on how to deploy on a cluster https://github.com/cohandv/external-pvc-scaler/blob/master/k8s/install.yml

Usage

  • Install this pod a a single instance in kube-system (recommended) using this template. if you want to override this, attach the config as volume at /app/config.ini

Configuration

This 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
  • This file can be mounted in /app/config.ini otherwise will take the default values in the default.ini file
  • The only entity supported now is a PVC
Query DO NOT GO WITH QUOTES! and conside that travel on the query string, so store it with the appropiate format

This 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

Tag summary

Content type

Image

Digest

Size

335 MB

Last updated

over 5 years ago

docker pull cohandv/external-k8s-pvc-resizer