Study guide
4.3 Autoscaling Workloads & Clusters (HPA, VPA, Cluster Autoscaler, KEDA)
Kubernetes and Cloud Native Associate KCNA
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Introduction & Exam Overview
1.1 About the KCNA Exam & Certification Path 1.2 How to Use This Study Guide
2 Chapter 2: Kubernetes Fundamentals - Cluster Architecture & the API
2.1 Kubernetes Architecture & Control Plane Components 2.2 Worker Node Architecture & Node Components 2.3 Kubernetes API, Declarative Management & kubectl 2.4 Kubernetes Releases, API Versioning & Deprecation Policy
3 Chapter 3: Kubernetes Fundamentals - Workloads & Configuration
3.1 Core Workload Objects (Pods, Deployments & ReplicaSets) 3.2 Advanced Controllers (StatefulSets, DaemonSets, Jobs & CronJobs) 3.3 Namespaces, Labels, Selectors & Annotations 3.4 ConfigMaps, Secrets & Application Configuration 3.5 Pod & Container Lifecycle, Restart Policies & Graceful Termination
4 Chapter 4: Kubernetes Fundamentals - Scheduling & Autoscaling
4.1 Scheduling, Resource Management & Node Selection 4.2 Advanced Scheduling: Affinity, Topology Spread, Priority & Disruption Budgets 4.3 Autoscaling Workloads & Clusters (HPA, VPA, Cluster Autoscaler, KEDA)
5 Chapter 5: Kubernetes Fundamentals - Cluster Administration & Extensibility
5.1 Kubernetes Distributions, Installation Tools & Managed Services 5.2 Cluster Administration: Node Maintenance, Upgrades & etcd Backup 5.3 Extending Kubernetes: CRDs, Operators & the Controller Pattern
6 Chapter 6: Kubernetes Fundamentals - Containerization
6.1 Container Fundamentals, Runtimes & Registries 6.2 Container Image Anatomy: Layers, Tags, Digests & Pull Policy
7 Chapter 7: Container Orchestration - Networking & Service Discovery
7.1 Kubernetes Networking, Services & Ingress 7.2 Cluster DNS & Service Discovery with CoreDNS 7.3 NetworkPolicies, Zero-Trust Segmentation & the Gateway API
8 Chapter 8: Container Orchestration - Storage
8.1 Storage Concepts (PVs, PVCs, StorageClasses & CSI) 8.2 Volume Types, Snapshots & Stateful Storage Operations
9 Chapter 9: Container Orchestration - Security
9.1 Kubernetes Security & Access Control (RBAC & ServiceAccounts) 9.2 The 4C's of Cloud Native Security & Supply-Chain Trust 9.3 Service Mesh, mTLS & Zero-Trust Service Identity
10 Chapter 10: Container Orchestration - Troubleshooting
10.1 Container Troubleshooting & Health Probes 10.2 Cluster & Node-Level Troubleshooting
11 Chapter 11: Cloud Native Application Delivery
11.1 Cloud Native CI/CD Pipelines & Build Tooling 11.2 GitOps & Package Management (Helm, Kustomize, Argo CD & Flux) 11.3 Deployment Strategies & Release Management 11.4 Progressive Delivery Automation: Argo Rollouts, Flagger & Feature Flags 11.5 Application Debugging & Developer Workflows in Kubernetes 11.6 Platform Engineering & Developer Self-Service
12 Chapter 12: Cloud Native Architecture - Observability & Principles
12.1 Cloud Native Observability (Logging, Metrics & Tracing) 12.2 Cloud Native Principles & Architecture Patterns 12.3 Serverless, FaaS & Event-Driven Architecture
13 Chapter 13: Cloud Native Architecture - CNCF Ecosystem & Community
13.1 The CNCF Landscape, Governance & Project Lifecycle 13.2 Cloud Native Community, Collaboration & Contribution
4.3 Autoscaling Workloads & Clusters (HPA, VPA, Cluster Autoscaler, KEDA)
Key Takeaways Explain This Topic AI
The Horizontal Pod Autoscaler changes the replica count of a Deployment or StatefulSet based on observed metrics, and requires resource requests to be set to compute CPU utilisation.
metrics-server supplies the resource metrics the HPA reads; without it, HPA reports unknown metrics and never scales.
The Vertical Pod Autoscaler adjusts CPU and memory requests rather than replica count, and traditionally must evict a Pod to apply new values.
The Cluster Autoscaler adds worker nodes when Pods are unschedulable and removes underutilised nodes, operating at the infrastructure layer rather than the workload layer.
KEDA extends the HPA with event-driven scalers for queue depth, stream lag, and cron schedules, and is the standard way to scale a Kubernetes Deployment to zero.
Last updated: August 2026
4.3 Autoscaling Workloads & Clusters (HPA, VPA, Cluster Autoscaler, KEDA)
Quick Answer: Kubernetes autoscales at four distinct layers. The Horizontal Pod Autoscaler (HPA) adds or removes replicas . The Vertical Pod Autoscaler (VPA) raises or lowers a Pod's CPU and memory requests . The Cluster Autoscaler (CA) adds or removes worker nodes . KEDA extends the HPA to external event sources — queue depth, stream lag, cron — and is what lets a Deployment scale all the way to zero .
Elasticity is one of the defining properties in the CNCF cloud native definition, and KCNA reliably tests whether you can name the right autoscaler for a stated symptom. The discriminator is always the same: what is being changed — replicas, request sizes, or machines?
- 1. The Four Layers at a Glance ┌──────────────────────────────────────────────┐
- EVENTS │ KEDA — scales on queue depth, lag, cron, │
- │ and to/from zero; drives an HPA underneath │
- └──────────────────────┬───────────────────────┘
- ▼
- ┌──────────────────────────────────────────────┐
- REPLICAS │ HPA — more/fewer Pods (scale out / in) │
- └──────────────────────┬───────────────────────┘
- ▼
- ┌──────────────────────────────────────────────┐
- POD SIZE │ VPA — bigger/smaller requests (scale up/down)│
- └──────────────────────┬───────────────────────┘
- ▼
- ┌──────────────────────────────────────────────┐
- NODES │ Cluster Autoscaler / Karpenter — more/fewer │
- │ machines when Pods cannot be scheduled │
- └──────────────────────────────────────────────┘
- 2. Horizontal Pod Autoscaler
The HPA is a control-loop controller that periodically (about every 15 seconds) reads metrics and updates the replicas field of a scale target. apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-hpa
spec:
scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: web
- minReplicas: 3
- maxReplicas: 30
metrics:
- type: Resource
resource:
name: cpu
target:
- type: Utilization
- averageUtilization: 70
- The Scaling Formula desiredReplicas = ceil( currentReplicas × ( currentMetric / targetMetric ) )
With 4 replicas averaging 90% CPU against a 70% target: ceil(4 × 90/70) = ceil(5.14) = 6 replicas.
Two Prerequisites Candidates Forget
metrics-server must be installed. It is not part of a default cluster. It aggregates kubelet resource statistics and serves the metrics.k8s.io API that both kubectl top and the HPA consume. Without it, the HPA reports <unknown> and never acts.
The Pods must declare CPU/memory requests . "70% utilisation" is meaningless without a denominator — utilisation is measured as a percentage of the request . A Pod with no CPU request cannot be scaled on CPU utilisation.
Metric Types
- Type Source Example
- Resource metrics-server CPU or memory utilisation
- Pods Custom metrics API Average requests-per-second per Pod
- Object Custom metrics API Requests-per-second on an Ingress
- External External metrics API Depth of a cloud message queue
- Damping Behaviour
Uncontrolled scaling oscillates. The HPA applies a stabilisation window — 300 seconds for scale-down by default, 0 for scale-up — so it reacts fast to load but retreats slowly. behavior.scaleDown and behavior.scaleUp policies let you tune both the window and the maximum rate of change.
3. Vertical Pod Autoscaler
The VPA answers a different question: are the requests on this workload right at all? It observes real consumption and recommends — or applies — new requests values.
Its three modes:
Mode Behaviour
Off Produce recommendations only. The safest and most common production use: a right-sizing report.
Initial Apply recommendations to newly created Pods only.
Auto / Recreate Actively update running Pods — historically by evicting and recreating them, since requests were immutable on a running Pod.
That eviction behaviour is the VPA's defining limitation and a favourite exam point. It is also why running the HPA and the VPA on the same CPU/memory metric conflicts : one adds replicas while the other resizes and restarts them, and they fight. The supported combination is HPA on CPU with VPA restricted to memory, or VPA in Off mode used purely for recommendations.
Kubernetes has been moving toward in-place Pod resizing so that requests can be changed without recreating the Pod. Until that is universally available, treat "VPA evicts Pods to resize them" as the correct exam answer.
4. Cluster Autoscaler
The HPA and VPA both assume there is somewhere to put the Pods. The Cluster Autoscaler supplies that assumption by talking to the cloud provider's node group or auto-scaling group API.
Scale up when one or more Pods are Pending because no node can satisfy them . The trigger is unschedulable Pods, not high CPU on existing nodes — this distinction is tested.
Scale down when a node has been underutilised for a sustained period (about 10 minutes by default) and everything on it can be rescheduled elsewhere. The node is cordoned, drained, and released.
A node will not be removed if it hosts Pods without a controller, Pods with restrictive PodDisruptionBudgets, Pods using local storage, or Pods carrying the cluster-autoscaler.kubernetes.io/safe-to-evict: "false" annotation.
Karpenter is a newer alternative that provisions right-sized instances directly from pending Pod requirements rather than scaling predefined node groups.
5. KEDA — Event-Driven Autoscaling
KEDA (Kubernetes Event-Driven Autoscaling) is a CNCF graduated project that fills the HPA's biggest gaps: external event sources and scale-to-zero.
A queue consumer has no meaningful CPU load while it waits, so CPU-based HPA cannot scale it. KEDA installs a ScaledObject CRD, polls the event source directly through one of its 60-plus scalers (Kafka, RabbitMQ, AWS SQS, Azure Service Bus, Redis, Prometheus, PostgreSQL, cron), and translates that signal into an HPA it manages on your behalf. apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: order-processor
spec:
scaleTargetRef:
- name: order-processor
- minReplicaCount: 0 # scale to zero when the queue is empty
- maxReplicaCount: 50
triggers:
- type: kafka
metadata:
- topic: orders
- lagThreshold: "100"
The minReplicaCount: 0 line is the headline capability: a plain HPA cannot go below 1, so scale-to-zero on Kubernetes means KEDA or Knative.
6. Diagnostic Table
- Symptom Correct autoscaler
- Latency rises at peak; CPU pinned at 95% HPA on CPU
- Pods are OOMKilled; requests were guessed VPA recommendation, then fix the requests
- New Pods sit Pending with Insufficient cpu Cluster Autoscaler
- Kafka lag grows while consumer CPU stays flat KEDA with a Kafka scaler
- A nightly batch service should cost nothing when idle KEDA cron scaler, or Knative
- kubectl top pods returns "Metrics API not available" Install metrics-server