Technically, the Horizontal Pod Autoscaler is a controller in the Kubernetes controller manager, and it is configured by HorizontalPodAutoscaler resource objects.
[…]
That's how the Horizontal Pod Autoscaler works, but how do you use it?
Configuring the Horizontal Pod Autoscaler to autoscale your app is done by creating a HorizontalPodAutoscaler resource.
[…]
When you define a HorizontalPodAutoscaler resource you have to specify such a metric.
But how does the Horizontal Pod Autoscaler know how to obtain these metrics?
[…]
The Horizontal Pod Autoscaler queries metrics from the metrics registry:
[…]
The Horizontal Pod Autoscaler is one of these clients.
[…]
Any metric that you want to use as a scaling metric must be exposed through one of these three metric APIs.
Because only in that way they are accessible to the Horizontal Pod Autoscaler.
[…]