Kubernetes Scaling Basics
Why Scaling Was Born
Picture a concert hall. Some nights only a few fans show up, other nights the hall is packed with thousands. If the hall can’t expand or shrink, fans either get turned away or resources go to waste. Kubernetes workloads face the same challenge: demand fluctuates, and pods must scale up or down to match.
Scaling was born as the concert hall manager of Kubernetes, ensuring workloads expand when demand spikes and shrink when traffic slows.
Two Types of Scaling
- Horizontal Pod Autoscaling (HPA):
- Adds or removes pods based on metrics (CPU, memory, custom metrics).
- Analogy: HPA is like adding more musicians to the stage when the crowd grows.
- Vertical Pod Autoscaling (VPA):
- Adjusts resources (CPU/memory) of existing pods.
- Analogy: VPA is like giving each musician better instruments instead of adding more players.
Global Context
- Enterprises: Use HPA for web apps with fluctuating traffic, VPA for backend services with predictable workloads.
- Cloud Providers: Managed Kubernetes services integrate autoscaling with cloud monitoring systems.
- Community: Scaling is taught worldwide as the foundation of cloud‑native elasticity.
Hands‑On Exercise
- Reflect: How does HPA add pods when CPU usage spikes, and how does VPA differ by resizing pods instead?
Simulate load and watch scaling:
kubectl run -i --tty load-generator --image=busybox /bin/sh
while true; do wget -q -O- http://web; done
Create an HPA:
kubectl autoscale deployment web --cpu-percent=50 --min=2 --max=10
kubectl get hpa
Enable Metrics Server (required for HPA):
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
The Hacker’s Notebook
- HPA is expansion for adding more pods to handle demand.
- VPA is optimization for resizing pods for efficiency.
- Lesson for engineers: Don’t guess workload sizes and let Kubernetes autoscale.
- Hacker’s mindset: Treat scaling as your elasticity lever. With it, you can handle global traffic surges without breaking a sweat.

Updated on Dec 30, 2025