Home / Companies / Sysdig / Blog / Post Details
Content Deep Dive

Trigger a Kubernetes HPA with Prometheus metrics

Blog post from Sysdig

Post Details
Company
Date Published
Author
David de Torres Huerta
Word Count
975
Language
English
Hacker News Points
-
Summary

The blog post explains how to set up a Kubernetes Horizontal Pod Autoscaler (HPA) using Prometheus metrics with the help of Keda, an open-source project that allows for more advanced scaling capabilities beyond the default Kubernetes metrics of CPU and memory. Keda facilitates the use of Prometheus queries and other scalers to scale Kubernetes pods, overcoming two main limitations of Kubernetes HPA: its inability to combine metrics and the limited metrics it exposes by default. The post details the installation of Keda via Helm and illustrates how Keda's ScaledObject Custom Resource Definition (CRD) can define scaling parameters using a Prometheus trigger. An example is provided to demonstrate how to scale the nginx-server deployment based on the nginx_connections_waiting metric, showcasing Keda's ability to use Prometheus queries to manage scaling. Additionally, Keda offers features such as scaling down to zero replicas, handling error connections, and secure connections with Prometheus endpoints, simplifying the process of creating and managing an HPA without extending the Kubernetes API metrics endpoint.