Skip to content

A golang based Kubernetes application which can scale volume dynamically

License

Notifications You must be signed in to change notification settings

opstree/dynamic-pv-scaler

Repository files navigation

GitHub Super-Linter Go Report Card Maintainability Docker Repository on Quay Apache License GitHub release (latest by date)

Volume Booster

A golang based Kubernetes application which has been created to overcome the scaling issue of Persistent Volume in Kubernetes. This can scale the Persistent Volume on the basis of threshold which you have set.

Getting Started

Architecture

Pre-requisites

Sorry none of these pre-requisites can be compromised. So you guys have to meet these requirements 🙂

  • Kubernetes cluster version should be greater than 1.11+
  • Prometheus should be have the information of Persistent Volume
  • In storageclass, allowVolumeExpansion flag should be true

Example:-

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
reclaimPolicy: Retain
allowVolumeExpansion: true # This should be true for every storage class
mountOptions:
  - debug
volumeBindingMode: Immediate

That's it

Configuration

We are using helm to maintain the deployment and release in Kubernetes cluster. Hit Me. But for configuration part this application accepts a yaml file .config.yaml:

---
- namespace: database
  scale_percentage: 50
  threshold_percentage: 80
  pvc_name: data-mysql-0

Configuration file overview:-

Field Default Value Possible Values Description
namespace - Any valid k8s namespace Persistent Volume's namespace which needs to be watched
scale_percentage - Any integer How much percent you want to scale your pv
threshold_percentage - Any integer The target percentage after which you want to scale the pv
pvc_name - Any valid k8s pvc name Name of the pvc which you want to scale

Make sure you have updated the configuration in values.yaml.

Installation

Simply use the helm chart to install it on your flavor of Kubernetes.

# Deploy the PV Scaler
helm upgrade dynamic-pv-scaler ./deploy/helm --install --namespace dynamic-pv-scaler

Verify the installation

helm test dynamic-pv-scaler --namespace dynamic-pv-scaler
kubectl get pods -n dynamic-pv-scaler

Logging

The application's logging interface is designed to print logs in JSON stdout. Example logs:-

Development

Please see our development documentation for details.

Release

Please see our release documentation for details.

Contact

If you have any suggestion or query. Contact us at

[email protected]