The four mechanisms that let Kubernetes match workload capacity to demand: HPA scales Pod replicas horizontally, VPA adjusts Pod resource footprints vertically, Cluster Autoscaler adds/removes nodes, and Node Auto-Provisioning creates tailored node pools. Synthesized from CKA Day 17 — Kubernetes Autoscaling Explained.
Why Autoscaling Matters
Static replica counts and fixed resource allocations waste money during low traffic and fail during spikes. Kubernetes autoscaling provides:
Benefit
Description
Cost efficiency
Reduce replicas or node count when demand drops
Performance resilience
Add capacity automatically before users experience latency
Operational simplicity
Eliminate manual 3 AM paging to scale services
Right-sizing
VPA recommends or applies optimal CPU/memory per container
The Four Autoscaling Mechanisms
Kubernetes provides autoscaling at two levels: Pod-level (how big or numerous are my Pods?) and Cluster-level (how many nodes do I have?).
Exam Note: HPA is the most commonly tested autoscaling topic on the CKA. VPA is conceptual knowledge. Cluster Autoscaler and Node Auto-Provisioning are real-world tools but rarely appear on the exam. Source: CKA Day 17
Horizontal vs Vertical Scaling
Dimension
Horizontal Scaling
Vertical Scaling
Direction
Out (more instances)
Up (bigger instances)
Kubernetes tool
HPA
VPA
App requirement
Must be stateless or shared-state
Can be stateful; single replica acceptable
Speed
Fast (seconds to create Pods)
Slower (may require evictions and restarts)
Ceiling
Limited by cluster node capacity
Limited by node size and resource quotas
Design Principle: Prefer horizontal scaling in Kubernetes. Pods are designed to be cattle, not pets. Vertical scaling is reserved for workloads that cannot be replicated easily. Source: CKA Day 17
Exam-style hands-on tasks for this topic. Complete each task before reviewing the solution. Time yourself — CKA tasks average 5–7 minutes.
Task 1: Create an HPA for a Deployment
You are asked to create an HPA for Deployment web targeting 50% CPU with min 2 and max 10 replicas.
Requirements: Use kubectl autoscale or a YAML manifest.
Verification:kubectl get hpa webSolution:
kubectl autoscale deployment web --cpu-percent=50 --min=2 --max=10
Task 2: Troubleshoot a Deployment That Is Not Scaling
A Deployment is not scaling up under load. You suspect Metrics Server or missing resource requests.
Requirements: Verify Metrics Server is installed and the Deployment template has CPU requests.
Verification:kubectl get hpa shows current/target percentages (not <unknown>).
Solution:
# Check Metrics Serverkubectl get pods -n kube-system | grep metrics-server# Check Deployment requestskubectl get deployment web -o yaml | grep -A 5 resources# If requests are missing, edit the Deployment to add them, then the HPA will calculate utilization.