Study guide

11.4 Horizontal and Vertical Pod Autoscaling in GKE

Google Cloud Associate Cloud Engineer ACE

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Introduction & Exam Overview

1.1 About the GCP Associate Cloud Engineer Exam 1.2 How to Use This Study Guide & Build a Study Plan

2 Chapter 2: Resource Hierarchy, IAM Basics & Cloud Identity

2.1 The GCP Resource Hierarchy: Organizations, Folders & Projects 2.2 Organization Policies & Granting IAM Roles 2.3 Cloud Identity: Managing Users and Groups

3 Chapter 3: APIs, Quotas & Billing Configuration

3.1 Enabling APIs and Provisioning Cloud Operations Suite 3.2 Assessing and Requesting Quota Increases 3.3 Billing Accounts, Project Linking & Billing Exports 3.4 Billing Budgets and Alerts

4 Chapter 4: Planning Compute & Storage Resources

4.1 Choosing the Right Compute Option: GCE vs. GKE vs. Cloud Run vs. Cloud Functions 4.2 Spot VMs, Custom Machine Types & Cost-Optimized Compute Planning 4.3 Choosing a Data Storage Product: Cloud SQL, BigQuery, Firestore, Spanner & Bigtable 4.4 Cloud Storage Classes & Persistent Disk Types

5 Chapter 5: Planning Network Resources

5.1 Load Balancing Options and Use Cases 5.2 Regional Resource Placement & High Availability Planning 5.3 Network Service Tiers: Premium vs. Standard

6 Chapter 6: Deploying Compute Engine Workloads

6.1 Launching Compute Engine Instances: Disks, SSH Keys & Availability Policies 6.2 Managed Instance Groups, Instance Templates & Autoscaling 6.3 OS Login and VM Manager for Fleet Configuration

7 Chapter 7: Deploying Google Kubernetes Engine Workloads

7.1 Installing and Configuring kubectl 7.2 Deploying GKE Clusters: Autopilot, Regional, Private & GKE Enterprise 7.3 Deploying Containerized Applications to GKE

8 Chapter 8: Deploying Serverless & Event-Driven Applications

8.1 Deploying Applications to Cloud Run and Cloud Functions 8.2 Event-Driven Architectures: Pub/Sub, Cloud Storage Triggers & Eventarc

9 Chapter 9: Deploying Data Solutions

9.1 Deploying Data Products: Cloud SQL, Firestore, Spanner, BigQuery & AlloyDB 9.2 Deploying Pub/Sub, Dataflow & Loading Data into Google Cloud

10 Chapter 10: Deploying Networking Resources & Infrastructure as Code

10.1 Creating VPCs, Subnets & Shared VPC 10.2 Firewall Rules, Cloud VPN & VPC Network Peering 10.3 Infrastructure as Code: Terraform, Config Connector, Cloud Foundation Toolkit & Helm

11 Chapter 11: Managing Compute Engine & GKE in Production

11.1 Connecting to and Managing Running Compute Engine Instances 11.2 Working with Snapshots and Custom Images 11.3 Managing GKE Clusters: Node Pools, Workloads & Artifact Registry Access 11.4 Horizontal and Vertical Pod Autoscaling in GKE

12 Chapter 12: Managing Cloud Run, Storage & Database Operations

12.1 Managing Cloud Run Revisions, Traffic Splitting & Scaling 12.2 Managing and Securing Cloud Storage Objects & Lifecycle Policies 12.3 Querying, Estimating Costs, Backup & Job Monitoring for Databases (Cloud SQL, BigQuery, Spanner, Dataflow)

13 Chapter 13: Networking Operations, Monitoring & Logging

13.1 Networking Operations: Subnets, Static IPs, Cloud DNS & Cloud NAT 13.2 Cloud Monitoring: Alerts, Custom Metrics & Dashboards 13.3 Cloud Logging: Buckets, Log Analytics, Routers & Filtering 13.4 Diagnostics, Ops Agent, Managed Service for Prometheus & Audit Logs

14 Chapter 14: IAM Policies & Role Types

14.1 IAM Policies: Structure, Bindings & Policy Hierarchy 14.2 IAM Role Types: Basic, Predefined & Custom Roles

15 Chapter 15: Service Accounts & Security Configuration

15.1 Creating Service Accounts & Assigning Least-Privilege Permissions 15.2 Assigning Service Accounts to Resources & Managing SA IAM Policies 15.3 Service Account Impersonation & Short-Lived Credentials

16 Chapter 16: Exam Readiness — Scenarios & Test-Day Strategy

16.1 Common ACE Exam Scenarios & Decision Frameworks 16.2 Test-Day Logistics, Time Management & Final Review Checklist

11.4 Horizontal and Vertical Pod Autoscaling in GKE

Key Takeaways Explain This Topic AI

Horizontal Pod Autoscaler (HPA) changes the number of Pod replicas (scale out/in) based on CPU, memory, custom, or external metrics; it requires per-container resource requests to be set for percentage-based targets to work.

Vertical Pod Autoscaler (VPA) changes the CPU/memory requests and limits of existing Pods (scale up/down) and runs in one of four modes: Off, Initial, Auto/Recreate, and the preview InPlaceOrRecreate.

HPA and VPA must never be configured against the same metric (e.g., both scaling on CPU) for the same workload — this creates conflicting, thrashing scaling decisions.

Multidimensional Pod autoscaling resolves the conflict by splitting responsibilities: VPA rightsizes one resource dimension (commonly memory) while HPA scales replica count on a different metric (commonly CPU or requests-per-second).

HPA smooths flapping by choosing the largest scaling recommendation observed over roughly the last five minutes; VPA needs at least ~24 hours of usage history for high-confidence recommendations and is unsuitable for sudden traffic spikes.

Last updated: July 2026

Why This Topic Matters

The last GKE-specific bullet in exam Domain 4 is "managing Horizontal and Vertical Pod Autoscaling" — and it is tested precisely because the two mechanisms sound similar but solve opposite problems, and combining them incorrectly is a real production failure mode, not just a trivia distinction. Expect ACE scenarios that describe a workload's traffic pattern (spiky vs. steady-but-unpredictable) and ask which autoscaler — or which combination — is the right fit.

Horizontal Pod Autoscaler (HPA): Scaling Out and In

The Horizontal Pod Autoscaler runs a control loop that periodically checks a workload's observed metrics against configured target thresholds and changes the number of Pod replicas accordingly — more replicas under load, fewer when load drops. Three categories of metrics can drive it:

Metric type Example When to use

Resource metrics CPU or memory utilization (raw value or % of requested resources) The default, simplest case — CPU-bound web/API workloads

Custom metrics Requests-per-second, queue depth reported by the app itself App-specific load indicators that CPU doesn't capture well

External metrics Cloud Pub/Sub queue backlog, a metric from outside the cluster Workloads bottlenecked by something other than compute (e.g., a message backlog)

Two mechanics matter for exam scenarios:

Percentage-based targets require resource requests. If a container has no CPU/memory requests set, HPA cannot compute "current usage as a percentage of requested resources," so percentage targets simply won't function — a common root-cause question on the exam ("HPA isn't scaling at all — why?" → missing resource requests).

Anti-flapping safeguard. To avoid rapid, repeated scaling in both directions, HPA "chooses the largest recommendation based on the last five minutes" of observed data rather than reacting instantly to every metric fluctuation. When multiple metrics are configured and one becomes temporarily unavailable, HPA will still scale up based on the largest calculable size, but it will not scale down until all metrics are healthy again — a deliberately conservative, availability-favoring default.

Creating an HPA is a one-line imperative command or a declarative object: kubectl autoscale deployment my-app --cpu-percent=60 --min=2 --max=10

Vertical Pod Autoscaler (VPA): Scaling Up and Down

Where HPA changes replica count , the Vertical Pod Autoscaler changes the CPU and memory requests and limits of the Pods themselves , based on analyzed historical usage. VPA computes a target recommendation plus lower/upper bounds, and applies it according to one of four update modes :

Update mode Behavior

Off Recommendations are computed and visible, but never automatically applied — useful for "advisory only" rollout

Initial Recommended values are applied only at Pod creation time; running Pods are left alone

Auto (sometimes called Recreate) VPA evicts and recreates the Pod with new resource requests/limits when a significant change is recommended

InPlaceOrRecreate (Preview) Attempts to resize the Pod's resources in place without recreation, falling back to recreation only when an in-place resize isn't feasible

VPA is designed for long-running, relatively homogeneous workloads and needs roughly 24 hours of historical usage data before its recommendations reach high confidence. It is explicitly not a fit for workloads with sudden traffic spikes — horizontal scaling handles those far better, because VPA's Auto mode reacts by recreating Pods, which is disruptive if triggered constantly.

The Conflict Rule and Multidimensional Pod Autoscaling

The single most exam-relevant rule in this section: HPA and VPA must never be configured to scale based on the same metric for the same workload. If HPA is watching CPU utilization to add/remove replicas while VPA is simultaneously watching CPU utilization to resize each Pod's CPU request, the two controllers fight each other — VPA's resizing changes the percentage HPA is measuring against, producing unstable, conflicting scaling decisions.

Multidimensional Pod autoscaling is the supported way to run both at once: split responsibility by dimension. A common, exam-favored pattern is VPA manages memory requests/limits (rightsizing to avoid OOM-kills or wasted memory) while HPA manages replica count based on CPU or a custom/external metric. Each autoscaler owns a distinct resource dimension, so they never contend for the same signal.

HPA vs. VPA vs. Cluster Autoscaler: Don't Confuse the Layers

Exam distractors frequently blend Pod-level autoscaling with node-level (cluster) autoscaling:

  • Scales what Trigger
  • HPA Number of Pod replicas CPU/memory/custom/external metric thresholds
  • VPA CPU/memory requests of existing Pods Historical usage analysis

Cluster Autoscaler Number of nodes in a node pool Unschedulable Pods (too many) or underutilized nodes (too few)

Cluster Autoscaler operates one layer below both Pod autoscalers: it doesn't look at Pod metrics directly, but reacts to whether Pods can currently be scheduled onto existing node capacity. All three can run together in a healthy cluster, but each solves a distinct scaling question — Pod count, Pod size, or node count.

Realistic Exam Scenario

A checkout API sees sharp, unpredictable traffic spikes during flash sales, while a nightly batch-reporting job has a steady but hard-to-predict memory footprint that occasionally causes OOM-kills. The ACE-correct design: put HPA on the checkout API , targeting CPU or requests-per-second with a wide min / max replica range to absorb spikes quickly, and put VPA in Auto mode on the batch job , letting it right-size memory requests over time from historical usage — since batch jobs tolerate a Pod recreation far better than a spiky, latency-sensitive API does. Neither autoscaler is applied to the same metric on the same workload.