📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Kubernetes Auto-Scaling

Auto-Scaling

5 min read Quiz at the end
HorizontalPodAutoscaler scales deployment replicas up or down based on CPU or memory utilisation.

Horizontal Pod Autoscaler

# HPA — scale pods based on CPU/memory
kubectl autoscale deployment myapp   --cpu-percent=70   --min=2   --max=10

# hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: myapp-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: myapp
  minReplicas: 2
  maxReplicas: 10
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70

kubectl get hpa
kubectl describe hpa myapp-hpa
Topic Quiz · 1 questions

Test your understanding before moving on

1. What does the HPA (HorizontalPodAutoscaler) scale based on by default?
💡 HPA scales replicas up or down based on observed CPU utilisation (or custom metrics).