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.
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.
- 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
Check test.yaml for how tests are run in CI.