Kubernetes Horizontal Pod Autoscaler¶
Introduction¶
This guide explains kubernetes horizontal pod autoscaler with practical kubectl commands, realistic output, and production-focused checks. The goal is to connect the concept to what you can observe with kubectl in a real cluster.
What It Means¶
In Kubernetes, this topic is part of the desired-state model: users submit objects to the API server, controllers reconcile actual state, and kubelets run containers on nodes.
Why It Matters¶
Understanding kubernetes horizontal pod autoscaler helps you troubleshoot faster because you know which object owns the behavior: pod, workload controller, service, node, scheduler, kubelet, or storage object.
Key Commands¶
kubectl get nodes -o wide
kubectl describe node worker-1
kubectl get pods -A --field-selector=status.phase=Pending
kubectl describe pod pending-pod -n app
kubectl get events -n app --sort-by=.lastTimestamp
Expected output:
NAME STATUS ROLES AGE VERSION
worker-1 Ready <none> 14d v1.30.2
Example Manifest¶
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: app
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27
ports:
- containerPort: 80
How to Verify It¶
kubectl get all -n app
kubectl describe deployment web -n app
kubectl get events -n app --sort-by=.lastTimestamp
Common Mistakes¶
- Memorizing definitions without checking the real object relationships.
- Confusing desired state in the manifest with actual state running on nodes.
- Ignoring namespace, labels, and owner references when tracing resources.
Quick Checklist¶
- Identify the Kubernetes object involved.
- Check owner references and labels.
- Read events for reconciliation errors.
- Verify actual pods, endpoints, or node placement.
Related Guides¶
- kubectl Get Pods
- Kubernetes Pod Explained
- Kubernetes Deployment Explained
- Kubernetes Service Explained
Summary¶
Kubernetes Horizontal Pod Autoscaler is easiest to understand through live objects. Use kubectl to connect the concept to manifests, events, controllers, and running pods.