What does Kubernetes' Horizontal Pod Autoscaler do?
Options
- It adds new nodes to the cluster when the load of the app grows
- It changes the number of pod replicas based on CPU or custom metrics (Correct option)
- It raises the memory limit of a pod when the pod runs short
- It moves pods between regions to balance the load of the cluster
Answer
Changes the number of pod replicas based on metrics like CPU or custom metrics
Why
The HPA watches a metric (e.g. average CPU at 70%) and adds Pods when load rises and removes them when it falls.
It changes the NUMBER of Pods (horizontal). Adding more machines to the cluster is the job of the Cluster Autoscaler; changing a Pod's CPU/memory size is the Vertical Pod Autoscaler.
It needs resource requests defined to calculate utilization.
Remember
HPA = more or fewer Pods based on load.