Containers · Scheduling, Resources & Health
Horizontal Pod Autoscaler
Cheat sheet · https://pcornel.dk/topic.php?topic=6156
Answer
The Horizontal Pod Autoscaler changes replica counts based on metrics (CPU/memory utilisation vs requests, or custom metrics).
Remember
Needs metrics-server (or a metrics adapter) and resource requests. Shows <unknown> when metrics are missing. Set sensible min/max and stabilisation windows.
First checks
kubectl get hpa— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
Verify in this order
metrics → HPA compares to target → scales the Deployment
Where it usually breaks
<unknown> targets mean metrics-server is missing or requests are not set.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6156