Skip to content

Simulate the HPAScaleToZero feature gate on managed Kubernetes clusters.

License

Notifications You must be signed in to change notification settings

machine424/kube-hpa-scale-to-zero

Repository files navigation

kube-hpa-scale-to-zero

ci docker helm

Simulate the HPAScaleToZero feature gate, especially for managed Kubernetes clusters, as they don't usually support non-stable feature gates.

kube-hpa-scale-to-zero scales down to zero workloads instrumented by HPA when the current value of the used custom metric is zero and resuscitates them when needed.

how

If you're also tired of (big) Pods (thus Nodes) that are only used 3 hours a day, give this a try ;)

Check the code and comments in main.py for more details.

Run/Deploy

  • Via Helm:
helm repo add kube-hpa-scale-to-zero https://machine424.github.io/kube-hpa-scale-to-zero
helm install RELEASE_NAME kube-hpa-scale-to-zero/kube-hpa-scale-to-zero -n RELEASE_NAMESPACE

See here for more details.

  • Run the docker image:

Docker images are published here.

  • Or clone the repo and run (needs Python >=3.10):
# python main.py --help
python main.py --hpa-label-selector foo=bar,bar=foo --hpa-namespace foo

Test

Check test.yaml for how tests are run in CI.