惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Scott Helme
Scott Helme
N
Netflix TechBlog - Medium
AI
AI
Security Latest
Security Latest
GbyAI
GbyAI
P
Proofpoint News Feed
Y
Y Combinator Blog
A
Arctic Wolf
G
Google Developers Blog
U
Unit 42
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
C
Check Point Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
Latest news
Latest news
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
WordPress大学
WordPress大学
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
The Hacker News
The Hacker News
Simon Willison's Weblog
Simon Willison's Weblog
V
V2EX
Project Zero
Project Zero
博客园_首页

Sealos Blog

Build a Full-Stack App with Claude Code + InsForge — Zero Backend Code | Sealos Blog InsForge vs Supabase: Which Backend for AI-Powered Development? | Sealos Blog Kubernetes NodePort Exhaustion: SSH Gateway Solution | Sealos Blog Claude Code Metrics Dashboard: Grafana Setup (2026) | Sealos Blog What Is RustFS? Apache 2.0 MinIO Alternative (2026) | Sealos Blog Claude Code Mobile: iPhone, Android & SSH (2026) | Sealos Blog Eaglercraft Server Hosting: Fast Setup (2026) | Sealos Blog An Honest Review: Migrating a Complex Microservice App from Heroku to Sealos | Sealos Blog The Ultimate Guide to Kubernetes Audit Logging for Security and Compliance | Sealos Blog Cost Optimization Shootout: Sealos Autonomous FinOps vs. Kubecost Manual Reports | Sealos Blog For CTOs: How to Cut Your Cloud Bill by 50% Without Sacrificing Performance | Sealos Blog Building Resilient Systems: A Deep Dive into Sealos High-Availability and Auto-Failover | Sealos Blog Building a Scalable Event-Driven Architecture with Sealos Managed Kafka | Sealos Blog Beyond kubectl apply: 5 GitOps Best Practices for Production-Ready CI/CD on Sealos | Sealos Blog Advanced RAG Pipelines: Why Your Choice of Vector Database (like Milvus) Matters | Sealos Blog Advanced MLOps: How to Monitor and Evaluate LLM Applications in Production | Sealos Blog A Developer's Guide to Kubernetes RBAC: Securing Your Cluster the Easy Way with Sealos | Sealos Blog A CISO's Guide to Cloud Development: Securing the CI/CD Pipeline with Sealos DevBox | Sealos Blog What is Kubernetes Multi-Tenancy? A Guide for Platform Engineers | Sealos Blog What is Infrastructure from Code (IfC)? The Next Step After Infrastructure as Code (IaC) | Sealos Blog What is GitOps? A Beginner's Guide to "Push-to-Deploy" Workflows | Sealos Blog What is eBPF? The Future of Kubernetes Networking and Security | Sealos Blog What is an "AI-Native" Platform? (And Why You Need One for MLOps) | Sealos Blog What is an Agentic Workflow? Building the Next Generation of AI Apps | Sealos Blog What is a Kubernetes Chargeback Model (And How Does it Save You Money?) | Sealos Blog What is a "Headless" Development Environment? (And How it Works with VS Code) | Sealos Blog What is a Graph-Based Vector Database? (And When to Use It Over Milvus) | Sealos Blog What is a "Cloud Operating System"? The Next Evolution of PaaS Explained | Sealos Blog The Real Cost of EKS: How Sealos Delivers a Simpler, Cheaper Kubernetes Experience | Sealos Blog The 3 Types of Kubernetes Autoscaling (HPA, VPA, CA) and How Sealos Manages Them for You | Sealos Blog Sealos vs Vercel: Why a Cloud OS Beats a Frontend Platform for Full-Stack Apps | Sealos Blog Sealos vs. Render vs. Fly.io: A 2025 Guide to the Best Heroku Alternatives | Sealos Blog Sealos vs. OpenShift: Kubernetes for Developers vs. Kubernetes for Ops Teams | Sealos Blog Sealos vs. Netlify: When to Choose a Full Kubernetes Platform over a Static Site Hoster | Sealos Blog Sealos vs. DigitalOcean App Platform: A Head-to-Head Comparison on Cost, Features, and Scalability | Sealos Blog Sealos vs. AWS Elastic Beanstalk: The Modern PaaS for Developers Who Hate YAML | Sealos Blog Sealos DevBox vs. AWS Cloud9: Why Your CDE Should Be Platform-Agnostic | Sealos Blog For Developers: Stop Wasting Time on DevOps. A 10-Minute Guide to Shipping Faster with DevBox. | Sealos Blog Deploying n8n with Docker: From Local Setups to a Radically Simple Cloud Alternative | Sealos Blog The Impact of Prompt Bloat: How the Sealos AI Proxy Can Cache Queries and Cut LLM Costs | Sealos Blog The FinOps Playbook: How to Implement Kubernetes Chargebacks and Showbacks with Sealos | Sealos Blog Smoke Testing for ML Pipelines: Catching Data and Model Errors Before They Hit Production | Sealos Blog Optimizing PostgreSQL Performance: A Guide to Sealos Managed Database Tuning | Sealos Blog Managing Kubernetes Multi-Tenancy: How Sealos Enforces Resource Quotas and Network Policies | Sealos Blog From Days to Minutes: How to Standardize Developer Environments for Your Entire Engineering Org | Sealos Blog For Platform Engineers: How to Build a Golden Path IDP (Internal Developer Platform) with Sealos | Sealos Blog For FinOps Managers: The 5 Leakiest Buckets in Your Kubernetes Budget (And How to Plug Them) | Sealos Blog For Educators & IT Admins: How to Provide a Secure, Scalable Cloud Lab for 1000+ Students on a Budget | Sealos Blog What is a Vector Database? A Beginner's Guide to Milvus, Pinecone, and More | Sealos Blog Why Your Microservices Architecture is Failing (And How a Cloud OS Can Fix It) | Sealos Blog The Total Economic Impact of Cloud Development Environments (CDEs) | Sealos Blog The Illustrated Guide to the Kubernetes Control Plane | Sealos Blog The MLOps Lifecycle Explained: From Data Prep to Model Deployment | Sealos Blog Beyond Vercel's AI Cloud: The Case for an AI-Native Operating System | Sealos Blog The Architecture of a Modern AI Application: A 2025 Blueprint | Sealos Blog GitHub Codespaces is Great, But Your Workflow is Incomplete. Here's Why. | Sealos Blog The Best Heroku Alternatives in 2025 for Scalability and Cost | Sealos Blog CAST AI vs. Kubecost vs. Sealos: Choosing the Right K8s Cost Management Tool | Sealos Blog DevBox vs. Gitpod vs. Replit: An Unbiased Comparison for 2025 | Sealos Blog Unlocking Hidden Savings: A Guide to Using Spot Instances Safely in Kubernetes | Sealos Blog Can a CDE Really Replace Your MacBook Pro? A Performance Benchmark | Sealos Blog The End of "Works on My Machine": Achieving 100% Reproducible Builds with DevBox | Sealos Blog The Ultimate Guide to GPU Provisioning and Management in Kubernetes | Sealos Blog Rightsizing Kubernetes Workloads: How to Stop Wasting Money on CPU and Memory Requests | Sealos Blog The 2025 Guide to Kubernetes Cost Optimization: 10 Strategies to Cut Your Bill in Half | Sealos Blog FinOps for Startups: How to Build a Cost-Conscious Culture from Day One | Sealos Blog How to Onboard a New Developer in Under 5 Minutes with Sealos DevBox | Sealos Blog Calculating Kubernetes Costs: A Breakdown of EKS, GKE, and AKS Pricing Models | Sealos Blog Case Study: How We Reduced Our Kubernetes Bill by 87% with Sealos | Sealos Blog Are You Overpaying for Managed Kubernetes? The True Cost of Vendor Lock-in | Sealos Blog Beyond Monitoring: How Sealos Autonomously Optimizes Your Cloud Spend | Sealos Blog A Practical Guide to Kubernetes Security: Hardening Your Cluster in 2025 | Sealos Blog A Secure-by-Design Development Workflow with Isolated Cloud Environments | Sealos Blog Setting Up a Collaborative Python Data Science Environment with DevBox | Sealos Blog Using the Sealos AI Proxy to Manage and Cache LLM API Calls | Sealos Blog Migration Guide: Moving Your Node.js & Postgres App from Heroku to Sealos in Under an Hour | Sealos Blog Serving Machine Learning Models at Scale: A Guide to Inference Optimization | Sealos Blog Headless Development with Sealos: Using Your Local VS Code with a Powerful Cloud Backend | Sealos Blog How to Build and Deploy a RAG Pipeline with Llama 3 and Milvus on Sealos | Sealos Blog From Localhost to Production in 15 Minutes: A Full-Stack CDE Workflow with Sealos DevBox | Sealos Blog GitOps on Autopilot: Implementing a CI/CD Pipeline with Sealos and GitHub Actions | Sealos Blog Fine-Tuning Open-Source LLMs on a Budget with Sealos | Sealos Blog From Docker Compose to Kubernetes: A Simple Migration Path with Sealos | Sealos Blog Building an AI Agentic Workflow with LangChain and Sealos | Sealos Blog What is Helm for Kubernetes? The Ultimate Package Manager Explained | Sealos Blog What is a Custom Resource Definition (CRD) in Kubernetes? | Sealos Blog What is a Kubernetes StatefulSet? A Practical Guide | Sealos Blog What is a Kubernetes Ingress Controller? A Guide to Smart Traffic Routing | Sealos Blog What is a Kubernetes Operator? Automating Complex Applications | Sealos Blog What is a Kubernetes Service? A Simple Guide for Developers | Sealos Blog Streamlining Your CI/CD Pipeline with a DevBox Build Environment | Sealos Blog Why Standardized Development Environments Are Key to Team Velocity | Sealos Blog What Is GitHub Codespace? | Sealos Blog DevBox Install? Skip It Entirely. Get a Ready-to-Code Environment in One Click with Sealos DevBox. | Sealos Blog How to Set Up a DevBox: The Ultimate Guide to 1-Click Cloud Development | Sealos Blog Empowering Indie Devs and Startup Teams: How Sealos DevBox Accelerates Agile Development | Sealos Blog From Chaos to Consistency: How Sealos DevBox Transforms Enterprise Development Workflows | Sealos Blog From Campus Labs to Cloud Freedom: How Sealos DevBox Supercharges Student Development | Sealos Blog How Sealos DevBox Cut Container Commit Time from 15 Minutes to 1 Second | Sealos Blog DevBox vs Codespaces: Which Remote Dev Environment Fits You Best? | Sealos Blog
The Power of Autoscaling: A Deep Dive into HPA, VPA, and Cluster Autoscaler | Sealos Blog
Sealos · 2025-09-18 · via Sealos Blog

Traffic doesn’t arrive politely. It surges during flash sales, dips at night, spikes after a product launch, and occasionally goes viral at 3:00 a.m. Without the ability to expand and contract capacity automatically, you either pay for idle infrastructure or risk degradation and outages at the worst possible moment.

Autoscaling in Kubernetes—spanning pods and nodes—promises a responsive, cost-effective, and resilient system. But it’s also nuanced. Horizontal Pod Autoscaler (HPA), Vertical Pod Autoscaler (VPA), and Cluster Autoscaler (CA) each address different layers of elasticity. Getting them right is often the difference between a smooth surge and a midnight firefight.

This article dives deeply into each autoscaler: what it is, why it matters, how it works, practical configuration, and how to combine them safely.


Kubernetes autoscaling operates at three layers:

  • Horizontal: Change the number of pod replicas for a workload (HPA).
  • Vertical: Change the CPU/memory resources requested by pods (VPA).
  • Cluster-level: Change the number of nodes to fit pending pods (Cluster Autoscaler).

Think of it as a chain:

  • HPA increases or decreases pod count to meet load targets.
  • VPA right-sizes pods so each replica has enough CPU/memory.
  • Cluster Autoscaler adds or removes nodes so the cluster has just enough capacity to run the desired pods.

When tuned together, these three create a responsive, efficient system. When misconfigured, they can fight each other, thrash, or fail to activate when you need them most.


What HPA is and why it’s important

HPA adjusts the number of pod replicas for a target workload (typically a Deployment, StatefulSet, or ReplicaSet) based on observed metrics. It’s the most common autoscaling mechanism because it:

  • Responds quickly to load changes.
  • Keeps replicas stateless and scalable.
  • Supports multiple metric sources (CPU, memory, custom, external).

Use HPA when:

  • Your service is horizontally scalable (stateless, or state is externalized).
  • You can measure a scalable signal (CPU, requests per second, queue length, latency SLOs via custom metrics).

How HPA works (the essentials)

  • HPA periodically fetches metrics via the Kubernetes Metrics API and/or Custom/External Metrics APIs.
  • It calculates the desired replica count using a target-tracking algorithm.
  • For resource metrics like CPU, a common formula is:
    • desiredReplicas = ceil(currentReplicas × currentMetric / targetMetric)
  • When multiple metrics are specified, HPA computes a proposed replica count per metric and uses the highest value (to avoid under-scaling).

Key inputs and behavior controls:

  • Metrics:
    • Resource metrics: CPU and memory (from metrics-server).
    • Custom/pod/object metrics: typically via a Prometheus adapter.
    • External metrics: from sources outside the cluster (e.g., cloud service queues).
  • Stabilization windows and scaling policies:
    • Stabilization windows dampen flapping by preventing immediate scale-down after a spike.
    • Policies allow setting max scale step changes per unit time.

HPA example (v2 API) with behavior and mixed metrics

Below is an example that scales based on CPU and a custom per-pod metric http_requests_per_second. It also configures scale-up/down behavior to reduce thrash.

Notes:

  • averageUtilization: 70 means keep CPU usage around 70% of requested CPU across pods.
  • The Pods metric averageValue: "20" means target 20 requests/s per pod; if actual is 100 total requests/s across 4 pods (25 per pod), HPA will scale up.
  • scaleDown stabilization window of 300 seconds prevents immediate scale-in after a transient drop.

Metrics backends you’ll need

  • metrics-server: Required for CPU/memory resource metrics.
  • Prometheus Adapter: Expose Prometheus queries as Custom/External Metrics. This enables scaling on QPS, latency, queue depth, etc.
  • KEDA (Kubernetes Event-Driven Autoscaling): A powerful complement to HPA that exposes external triggers (Kafka lag, RabbitMQ, cloud queues) and manages HPAs for you.

Practical tips for HPA

  • Pick the right signal:
    • CPU works for CPU-bound work.
    • For web services, QPS per pod or concurrency per pod is often better.
    • For queues, use lag/backlog signals (KEDA makes this easy).
  • Avoid memory utilization as the sole signal for HPA:
    • Memory pressure is sticky; pods may not release memory quickly.
    • Prefer VPA for memory right-sizing; use HPA for load.
  • Set sane minReplicas:
    • Keep a warm baseline to avoid cold starts during regular traffic spikes.
  • Use behavior policies:
    • Limit scale-up step changes and slow down scale-down to reduce thrashing.

Useful commands:

  • kubectl top pods -n apps
  • kubectl describe hpa web-frontend-hpa -n apps

What VPA is and why it matters

VPA automatically adjusts pod CPU/memory requests (and optionally limits) to match actual usage. It’s invaluable for:

  • Right-sizing workloads to reduce waste or prevent OOMKills.
  • Batch jobs and stateful services that aren’t easily sharded horizontally.
  • Establishing baseline resource requests for new services.

Why it’s important:

  • HPA depends on requests (e.g., CPU utilization is measured against requests). Bad requests lead to incorrect HPA decisions.
  • Right-sized requests improve bin-packing and cluster efficiency, lowering costs.

How VPA works (components and modes)

VPA includes:

  • Recommender: Watches historical usage and recommends requests.
  • Updater: Evicts pods that are under/over-provisioned so they can be recreated with new requests.
  • Admission Controller: Mutates pod specs on creation to apply recommendations.

Update modes:

  • Off: No changes; only recommendations are produced. Good for observe-first.
  • Initial: Sets recommended requests on pod creation but doesn’t evict running pods.
  • Auto: Can evict and recreate pods to apply updated recommendations.

VPA recommends CPU/memory based on usage percentiles and safety margins, avoiding extreme spikes. Recommendations are exposed in the VPA object status.

VPA example (observe first, then automate)

Start with observe-only to build confidence:

After a week of traffic, inspect:

  • kubectl describe vpa web-frontend-vpa -n apps
  • Review recommendations and consider switching updateMode to Initial or Auto.

Important compatibility note:

  • Do not run HPA and VPA on the same resource (CPU/memory) for the same workload. If you need both, use HPA with a custom metric (e.g., QPS) and let VPA manage CPU/memory requests.

Practical applications for VPA

  • Batch and ML workloads: Right-size heavy jobs to avoid over-requesting.
  • Services with memory unpredictability: Prevent OOMs by nudging requests upward.
  • Establish baselines for new microservices: Run Off mode to gather data, then apply.

What CA is and why it matters

Cluster Autoscaler adjusts the number of nodes in your cluster to fit pending pods. It interacts with your cloud provider or cluster manager to:

  • Scale up: Add nodes when pods are unschedulable due to insufficient resources.
  • Scale down: Remove underutilized nodes safely to save costs.

Without CA, HPA can scale pods up all it wants, but if there are no nodes to host them, they remain pending. CA closes the loop at the infrastructure level.

How Cluster Autoscaler works

  • Watches for unschedulable pods.
  • Simulates scheduling across node groups and decides whether adding nodes could help.
  • Chooses which node group to scale using an “expander” strategy (e.g., least-waste, most-pods, price).
  • For scale-down, identifies nodes that are underutilized or empty for a configurable time window and tries to drain them, respecting:
    • Pod Disruption Budgets (PDBs)
    • DaemonSets
    • Pods using local storage or with restrictive disruption policies
    • System critical priorities

It won’t remove a node if doing so violates PDBs or cannot safely evict pods.

A typical CA deployment (conceptual flags)

You usually deploy CA as a Deployment in kube-system with provider-specific flags. This snippet shows common tuning flags (names vary by provider):

Provider-specific integrations (GKE, EKS, AKS, on-prem, etc.) differ in setup. If you’re on a managed Kubernetes platform, check if CA is built-in or configured through your provider’s console.

Practical tips for CA

  • Use node groups for different workload classes (e.g., CPU-optimized vs. memory-optimized).
  • Label/taint nodes and match with workload tolerations to ensure pods land on appropriate nodes.
  • Respect PDBs but set them realistically; overly strict PDBs can block scale-down indefinitely.
  • Consider an overprovisioning “buffer” with low-priority pods:
    • Run tiny pause pods with a very low priority. CA scales up to fit them, keeping warm capacity ready.
    • When real workload arrives, these buffer pods are preempted quickly.

Alternatives and complements:

  • Karpenter (AWS): A dynamic node provisioning project that can improve bin-packing and reduce scheduling latency.
  • Descheduler: Not an autoscaler but helps rebalance pods, improving long-term efficiency.

Here’s a quick comparison:

DimensionHPAVPACluster Autoscaler
ScalesNumber of podsCPU/memory per pod (requests/limits)Number of nodes
Primary signalCPU, memory, custom/external metricsHistorical resource usageUnschedulable pods / node utilization
Reaction speedFast (seconds to minutes)Moderate (minutes to hours)Moderate (minutes)
Best forStateless services, event/HTTP loadRight-sizing, batch/statefulCost control, capacity management
RisksThrashing if mis-tunedEvictions can cause disruptionsScale-down blocked by PDBs, taints

Guidance:

  • Start with HPA for stateless services.
  • Add VPA in Off/Initial mode to right-size requests, then consider Auto.
  • Ensure CA is enabled in cloud environments so scale-outs have someplace to land.

Patterns that work well:

  • HPA on custom signal + VPA for CPU/memory
    • Example: Web service scales on QPS per pod (HPA) while VPA sets CPU/memory requests.
  • HPA for horizontal elasticity + CA for cluster capacity
    • HPA adds replicas; CA adds nodes if needed.
  • VPA for batch jobs + CA for elastic node pools
    • VPA ensures jobs get sufficient resources; CA adds nodes to run them.

Avoid:

  • HPA and VPA both acting on CPU/memory for the same target. If HPA uses CPU utilization (derived from requests) and VPA changes requests, feedback loops and oscillations can occur.

Use guardrails:

  • Stabilization windows and scale policies in HPA.
  • Reasonable min/max in VPA resourcePolicy.
  • PDBs that allow controlled disruption but don’t block all scale-downs.

If CPU doesn’t correlate with load, use better signals:

  • Requests per second per pod
  • Active connections
  • Queue length / lag
  • 95th percentile latency versus an SLO target

Two common approaches:

  • Prometheus Adapter: exposes Prometheus queries as Custom/External Metrics. You define rules mapping metrics to API endpoints HPA can consume.
  • KEDA: defines ScaledObjects that connect to event sources (Kafka, RabbitMQ, Prometheus, Azure Queue, etc.) and manages the HPA for you.

Example: KEDA scaling on Kafka lag

KEDA calculates desired replicas from lag and updates an HPA behind the scenes.


To make autoscalers effective, close the loop with measurement and feedback:

  • Monitor autoscaler events:
    • kubectl describe hpa/vpa deployments to see scale decisions and reasons.
  • Track key metrics:
    • HPA: desired vs. current replicas, metric values, stabilization triggers.
    • VPA: recommendation ranges, eviction counts, pod restarts.
    • CA: pending pods, scale-up/down events, blocked scale-down reasons.
  • Alert on anomalies:
    • Repeated oscillations, constant close-to-max replicas, chronic pending pods.
  • A/B test policies:
    • Try different stabilization windows and scale step limits in staging.
  • Warm-up times and readiness:
    • Consider container start times and cache warm-ups when setting minReplicas and scale-up steps.

PitfallSymptomMitigation
CPU as a poor proxyHPA flaps or lags loadUse custom metrics aligned with SLOs (QPS, latency, queue)
Overaggressive scale-downTraffic “sawtooth” and cold startsIncrease scaleDown stabilization window; set minReplicas
HPA + VPA conflictReplica oscillation after VPA updatesUse HPA on custom metrics; let VPA manage CPU/memory
CA blocked by PDBsNodes never scale downRelax PDBs; allow some disruptions during low traffic
Node taints mismatchPods stay pending during scale-upAlign taints/tolerations; ensure CA has correct node groups
Memory-driven HPAScale decisions don’t resolve pressureUse VPA for memory; HPA on CPU or custom signal
Missing metrics backendHPA in “Unknown” stateInstall metrics-server; configure Prometheus Adapter or KEDA

Scenario: You operate a web frontend and a background orders consumer. You want smooth scaling during traffic spikes and cost efficiency overnight.

  1. Right-size requests with VPA in observe mode:
  • Deploy VPA with updateMode: Off for both workloads.
  • After a week, apply recommendations with Initial mode to set baseline requests on new pods.
  1. Scale web frontend with HPA on QPS and CPU:
  • HPA targets 70% CPU and 20 RPS per pod, with stabilization windows. Min replicas set to keep cache warm.
  1. Scale orders consumer with KEDA on Kafka lag:
  • KEDA ScaledObject ensures consumers scale with backlog, reducing latency during spikes.
  1. Enable Cluster Autoscaler:
  • CA configured with least-waste expander and appropriate node groups (e.g., general-purpose for web, compute-optimized for consumers).
  • Add a tiny overprovisioning buffer using a low-priority Deployment to reduce cold-start risk.
  1. Observe and iterate:
  • Monitor SLOs (99th percentile latency), HPA decisions, VPA recommendations, CA scale events.
  • Tune scale step sizes and stabilization windows to eliminate oscillation.
  • Confirm PDBs allow safe but effective scale-down.

If you prefer a cloud-native platform that makes Kubernetes easier to operate, Sealos (https://sealos.io) provides a multi-tenant cloud OS experience where you can run containerized apps with built-in Kubernetes under the hood. On Sealos:

  • Deploy your workloads using a simple application workflow while still benefiting from Kubernetes primitives like HPA and VPA.
  • Integrate metrics (e.g., Prometheus) and autoscaling policies without standing up all components from scratch.
  • Manage cluster resources and costs more transparently, including node scaling with underlying infrastructure.

This can be especially useful for teams that want Kubernetes-level control with a simpler operational surface for autoscaling.


  • Install and verify metrics-server.
  • Choose your scaling signals:
    • CPU for CPU-bound, custom metrics for user load, KEDA for external event sources.
  • Start VPA in Off mode to gather recommendations; consider Initial or Auto later.
  • Configure HPA with:
    • Min/max replicas
    • Stabilization windows and scale policies
    • Mixed metrics if needed (CPU + custom)
  • Enable Cluster Autoscaler (or provider equivalent), validate:
    • Node groups and labels/taints
    • PDBs don’t block scale-down entirely
    • Expander strategy fits your cost/perf goals
  • Add observability: dashboards for HPA/VPA/CA decisions and SLOs.
  • Load-test before production to validate behavior under stress.

  • Can I use HPA and VPA together?

    • Yes, but avoid both acting on CPU/memory for the same workload. A common pattern is VPA managing CPU/memory while HPA scales on custom metrics like QPS.
  • How fast will autoscaling react?

    • HPA can respond in tens of seconds to a couple of minutes depending on metrics resolution and stabilization. CA adds nodes in minutes. VPA is slower as it relies on historical data.
  • Do I need Prometheus to use custom metrics?

    • Not strictly, but Prometheus + Prometheus Adapter is a popular and flexible path. KEDA provides many external triggers without custom adapter complexity.
  • What about stateful services?

    • Stateful workloads can use VPA; HPA may be more constrained. Ensure disruption policies and readiness/liveness probes are tuned to avoid data loss.

Autoscaling isn’t just a cost-control tool—it’s operational leverage. HPA keeps services responsive by adapting replicas to demand. VPA quietly right-sizes resources to keep workloads healthy and efficient. Cluster Autoscaler ensures infrastructure elasticity so your pods have room to run.

Together, they transform your cluster into an adaptive system that meets user demand, protects SLOs, and avoids paying for idle capacity. Start with good signals, add guardrails (stabilization, min replicas, PDBs), and iterate with data. Whether you run Kubernetes on your own, on a managed cloud, or via a platform like Sealos, mastering autoscaling will help you ride the next traffic spike—not be crushed by it.