Kubernetes·Kubernetes from first pod to production app

Scaling

Scale replicas manually and automatically based on real signals.

Intermediate 13 min read Lesson 8 of 300 Challenge included
What you will be able to do
  • Set resource requests before HPA.
  • Use HPA for variable traffic.
  • Scale on the right metric.
  • Keep stateless pods for easy scaling.

In plain English

Horizontal Pod Autoscaler adds replicas when CPU or custom metrics exceed targets. It needs resource requests to calculate utilisation. Scale on the signal that actually limits you, not just CPU.

terminalTerminal
kubectl autoscale deployment web --cpu-percent=60 --min=2 --max=10
kubectl get hpa
kubectl top pods
Your turn

Create an autoscaler

Medium

Write a command to autoscale web between 2 and 10 replicas at 60% CPU.

BASH · starter
kubectl autoscale
Check your understanding before moving on.
Knowledge checkQuestion 1

What does HPA need in order to scale on CPU?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Observability
Lesson 8 of 300 · 0% of course