Roadmap › Kubernetes (K8s) & AKS › Module: Running Workloads Well
Lessons in this course (15)

7. Resources, QoS and autoscaling

Intermediate★ Must knowLesson 7 of 15
  • requests — what the scheduler reserves (placement decisions). limits — the maximum: CPU over limit is throttled; memory over limit → container OOMKilled.
  • QoS classes: Guaranteed (requests = limits for all), Burstable (requests < limits), BestEffort (none — evicted first).
  • HPA (Horizontal Pod Autoscaler) — scales replicas on CPU/memory or custom/external metrics.
  • VPA — recommends/adjusts requests. Cluster Autoscaler / AKS Node Auto Provisioning (Karpenter) — adds/removes nodes when pods can't be scheduled.
  • KEDA — scale on events (Service Bus queue length, Kafka lag, cron), including to zero.
  • PodDisruptionBudget — keep minimum replicas available during voluntary disruptions (node upgrades/drains).
  • ResourceQuota / LimitRange — per-namespace caps and defaults.
yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: { name: shop-api }
spec:
  scaleTargetRef: { apiVersion: apps/v1, kind: Deployment, name: shop-api }
  minReplicas: 3
  maxReplicas: 20
  metrics:
    - type: Resource
      resource: { name: cpu, target: { type: Utilization, averageUtilization: 70 } }