Stage 10, Part 3 of 9, Autoscaling & Cost Optimization
Text
PART 3: PRODUCTION FAILURE MODES
14. Top 10 Autoscaling & Cost Failures
#
Failure
Symptom
Root Cause
Fix
1
PDB blocks scale-down
Nodes never removed
PDB prevents eviction
Adjust PDB
2
HPA/VPA conflict
Unstable replicas
Both scale on CPU
Separate metrics
3
Inflated requests
Cluster appears busy
Requests >> usage
VPA rightsizing
4
Karpenter consolidation storm
Constant node churn
Consolidation too aggressive
Tune consolidation policy
5
Spot interruption cascade
Multiple pods evicted
All replicas on same spot pool
Diversify, PDB
6
HPA metric unavailable
HPA doesn't scale
Custom metrics API down
Fix metrics adapter
7
KEDA scaler misconfiguration
Scale to zero unexpectedly
Wrong metric threshold
Tune scaler
8
Cluster Autoscaler slow
Pods Pending for minutes
3-4 minute provisioning
Migrate to Karpenter
9
Cost anomaly
Unexpected bill spike
Runaway workload, no limits
Set limits, alerts
10
Bin-packing breaks HA
Single node failure kills service
Over-consolidation
Pod anti-affinity
The PDB Deadlock (Real Production Lesson)
A PDB defines how many pods must remain available during voluntary disruptions. In one production case, CPU utilization across nodes was very low, but the cluster was not scaling down. The PDB configuration prevented Kubernetes from evicting the pods. Because the pods could not be evicted, the autoscaler was not allowed to remove the node. This type of configuration issue can cause nodes that never scale down, wasted compute resources, and significantly increased cloud costs in large clusters.
15. Autoscaling Debugging Runbook
“HPA isn’t scaling” — Step-by-Step
text
STEP 1: Check HPA status
$ kubectl get hpa
$ kubectl describe hpa <name>
# Look at current metrics, desired replicas, conditions
STEP 2: Check metrics availability
$ kubectl top pods
$ kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes
# If empty, metrics-server is down
STEP 3: Check resource requests
$ kubectl get deployment <name> -o jsonpath='{.spec.template.spec.containers[*].resources.requests}'
# HPA uses requests for CPU utilization %
STEP 4: Check HPA events
$ kubectl get events --field-selector involvedObject.name=<hpa-name>
STEP 5: Check custom metrics (if used)
$ kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1
STEP 6: Check behavior policies
$ kubectl get hpa <name> -o yaml | grep -A20 behavior
# Stabilization windows may be blocking
STEP 7: Escalate
“Cluster isn’t scaling down” — Step-by-Step
text
STEP 1: Check node utilization
$ kubectl top nodes
STEP 2: Check PDBs
$ kubectl get pdb -A
$ kubectl describe pdb <name>
# PDB may be blocking eviction
STEP 3: Check Cluster Autoscaler logs
$ kubectl logs -n kube-system -l app=cluster-autoscaler --tail=100
STEP 4: Check Karpenter logs (if using Karpenter)
$ kubectl logs -n karpenter -l app.kubernetes.io/name=karpenter --tail=100
STEP 5: Check for pods that can't be evicted
$ kubectl get pods -A --field-selector status.phase=Running
# Look for pods without controllers (bare pods)
STEP 6: Check node annotations
$ kubectl describe node <node> | grep -A5 "Annotations"
STEP 7: Escalate
16. Blast Radius Analysis
What Happens When Autoscaling Fails?
Component
Impact
Severity
HPA down
No replica scaling; capacity fixed
SEV-2
VPA down
No rightsizing
SEV-3
KEDA down
No event-driven scaling
SEV-2
Karpenter down
No node provisioning
SEV-1
Cluster Autoscaler down
No node scaling
SEV-1
Cost monitoring down
No visibility
SEV-3
PDB blocking scale-down
Wasted cost
SEV-3
Mitigation Strategies
Strategy
Implementation
HA autoscalers
Multiple replicas
Fallback
On-demand node groups
Monitoring
Alerts on scaling events
Cost alerts
Budget alerts
Testing
Chaos engineering for scaling
1:1 copy of the class Google Doc, code in code blocks.