EKS and Horizontal Pod Autoscaler

Publish date: Tue, Jul 3, 2018

Follow the kubernetes tutorial to test out HPA.


Horizontal Pod Autoscaler The Horizontal Pod Autoscaler automatically scales the number of pods in a deployment or replica set. HPA typically works off of CPU utilization, but it is now possible to utilize custom metrics for scaling.

The Horizontal Pod Autoscaler feature was first introduced in Kubernetes v1.1 and has evolved a lot since then. Version 1 of the HPA scaled pods based on observed CPU utilization and later on based on memory usage. In Kubernetes 1.6 a new API Custom Metrics API was introduced that enables HPA access to arbitrary metrics. And Kubernetes 1.7 introduced the aggregation layer that allows 3rd party applications to extend the Kubernetes API by registering themselves as API add-ons.

The Horizontal Pod Autoscaler is implemented as a control loop that periodically queries the Resource Metrics API for core metrics like CPU/memory and the Custom Metrics API for application-specific metrics.

HPA control loop


Unfortuntely, the Metrics Server is not an approved add-on for EKS at this time. So, it is NOT possible to run HPA on an EKS cluster out of the box. It may be possible to hack it, but I have not had success. Since heapster is supported, it also may be possible to use an older version of HPA instead of the more recent releaseses. Since AWS typically moves quickly on features for new products, I would expect and hope to see metrics server available soon…



Metrics Server

Metrics API

HPA with Prometheus

EKS documentation - html or EKS documentation - PDF