Autoscale Workloads with the Horizontal Pod Autoscaler
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
In this advanced lab you will deploy a CPU-intensive web application, expose it as a service, install the Kubernetes Metrics Server so that resource metrics are available, configure a Horizontal Pod Autoscaler (HPA) to automatically scale the deployment based on CPU utilisation, and finally drive artificial load through the service to trigger and observe autoscaling in action. By the end of this lab you will understand the full HPA lifecycle: metrics pipeline, autoscaler policy, scale-up behaviour, and cool-down.
What you’ll learn
- Deploy the Kubernetes Metrics Server and verify that node and pod CPU/memory metrics are available via kubectl top
- Deploy a CPU-bound PHP Apache workload with explicit resource requests and expose it via a ClusterIP service
- Create and configure a Horizontal Pod Autoscaler targeting 50% average CPU utilisation and validate automatic scale-up under load
How this lab works
- Start the lab: One click starts a real Kubernetes cluster on your computer (kind), with kubectl ready in a toolbox terminal.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads your live cluster and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Cluster: A real Kubernetes cluster on your computer (kind)
- Kubernetes: 1.34.8
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop installed and running
- A kind cluster created in the Kubernetes Playground
Topics: hpa, autoscaling, horizontal-pod-autoscaler, metrics-server, cpu, scaling, workloads, kubectl, kind
Create a free account to start this lab.