The Desi Architect
Notes / Docker Sandboxes / Resources and Autoscaling Under Load
Docker Sandboxes · Tier 5: Orchestrate: Kubernetes on your laptop · Lab 64

Resources and Autoscaling Under Load

Scale applications automatically under traffic surges using Kubernetes HorizontalPodAutoscaler. Deploy metrics-server, configure CPU requests and limits, generate live load on port 18304, and watch replicas scale from 2 to multiple pods and back.

Time40 minutes
StackKubernetes v1.37Ports 18304
Memory1.3GB
Before thisLab 60Your First Cluster
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Configure container resource requests (100m CPU) and resource limits (200m CPU).
  • Vendor and deploy metrics-server v0.9.0 with custom certificates inside a kind cluster.
  • Define a HorizontalPodAutoscaler (HPA) targeting 50% average CPU utilization.
  • Generate concurrent CPU load and witness automatic scale-up from 2 to multiple replicas.
  • Explain why reactive autoscaling requires scheduled pre-scaling for sharp Tatkal morning surges.

Before you start

Finish Lab 60 (Your First Cluster) and Lab 09 (Load Testing with k6) first. You should understand how CPU saturation impacts latency. Give Docker at least 4 GB of memory, and make sure kind and kubectl are installed.