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

推荐订阅源

Know Your Adversary
Know Your Adversary
小众软件
小众软件
L
LangChain Blog
月光博客
月光博客
博客园 - Franky
Microsoft Azure Blog
Microsoft Azure Blog
Y
Y Combinator Blog
有赞技术团队
有赞技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
MongoDB | Blog
MongoDB | Blog
Recorded Future
Recorded Future
V
Visual Studio Blog
TaoSecurity Blog
TaoSecurity Blog
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
L
LINUX DO - 热门话题
C
Check Point Blog
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
The Hacker News
The Hacker News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
博客园 - 司徒正美
T
Threatpost
P
Palo Alto Networks Blog
A
About on SuperTechFans
Spread Privacy
Spread Privacy
Engineering at Meta
Engineering at Meta
N
News | PayPal Newsroom
T
Tailwind CSS Blog
The Last Watchdog
The Last Watchdog
Blog — PlanetScale
Blog — PlanetScale
A
Arctic Wolf
量子位
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 聂微东
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Vulnerabilities – Threatpost
H
Hacker News: Front Page

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Karpenter consolidation: 6 settings worth tuning in 2026
Muskan · 2026-06-23 · via DEV Community

Quick take

Karpenter's defaults are tuned for compute cost, not for your workload's tolerance for disruption. Six settings decide whether consolidation saves you 40% or causes a Sev-2 every Tuesday. Tune them once and the autoscaler stops being a footgun.

If you only have 90 seconds, this is the shape:

  • consolidationPolicy: WhenEmptyOrUnderutilized is the right default for most prod fleets in 2026.
  • consolidateAfter at the wrong value causes either expensive idle nodes or thrashy churn.
  • disruption.budgets is the safety net that decides how many nodes can churn at once.

Why Karpenter defaults are not your defaults in 2026

Karpenter 1.0 hit GA in late 2024, and the defaults shifted again with 1.2 in mid-2025. The defaults work well for stateless web traffic and absolutely break stateful workloads.

I have walked into three incidents in the last six months where the same root cause showed up: Karpenter aggressively consolidating during a deploy, killing pods mid-request, and the team blaming the application. The application was fine. The autoscaler was set to disrupt nodes faster than the rolling restart could finish.

Two things changed in 2026 that make this worse:

  • Spot interruption rates are higher in popular instance families like m7i and c7i, so Karpenter rotates more often.
  • Multi-arch fleets (Graviton4 plus x86) mean Karpenter has more right-sizing candidates, and "right-size everything" is the default instinct.

The fix is to tune six specific settings against your workload, not against Karpenter's idea of a workload.

1. consolidationPolicy

The most consequential setting. Two valid values in 2026.

WhenEmpty consolidates only when a node has zero workload pods. Safe but leaves a lot of money on the table because underutilized nodes (10% CPU, 30% memory) keep running.

WhenEmptyOrUnderutilized is the 2026 default for cost-sensitive teams. Karpenter will replace a half-empty node with a smaller one when the math says it saves money. The risk is more frequent disruption.

For stateful workloads, batch jobs, or anything with long-running connections, start with WhenEmpty. Move to WhenEmptyOrUnderutilized only after you have PDBs and graceful termination in place.

2. consolidateAfter

The "wait this long before consolidating" timer. Default in 1.2 is 1m. Almost always wrong.

The problem with 1 minute: a CI job that takes 90 seconds to start, runs for 4 minutes, and exits looks like a "stable enough to consolidate" workload. Karpenter then disrupts the node that was about to receive the next job, and the queue backs up.

What I use in prod:

  • Stateful or latency-sensitive: consolidateAfter: 10m
  • Mixed workloads: consolidateAfter: 5m
  • Pure stateless web: consolidateAfter: 2m
  • Batch-heavy clusters: consolidateAfter: 15m to let job queues drain

Above 15 minutes you stop saving money because nodes stay overprovisioned. Below 2 minutes you cause thrashing.

3. disruption.budgets

This is the blast-radius limiter and the single most important safety setting. A budgets block controls how many nodes can be consolidated at once.

The default since 1.0 is 10%. That sounds safe and is fine for clusters with 50+ nodes. On a 4-node cluster, 10% rounds to "anytime" because there is no fractional node. Set explicit numbers, not percentages, on small clusters.

A reasonable budget for a 20-to-100-node production cluster:

  • 10% during business hours
  • 25% during low-traffic windows (overnight, weekends)
  • 0% during deploy windows or known traffic spikes

The schedule is set via the schedule field with cron syntax. Use it. Most teams that get burned by Karpenter never set a deploy-window budget of zero.

4. disruption.expireAfter

The "kill any node older than this" setting. Default is Never, which sounds good but is a security problem and a hidden cost driver in 2026.

Why expire nodes:

  • Long-lived nodes accumulate kernel and AMI drift. A node that booted three months ago is running on a security-patched image that is also three months stale.
  • Spot instances that survive a long time tend to have higher interruption probability. Forcing replacement spreads the risk.
  • For Reserved Instance and Savings Plan optimization, predictable node turnover helps Karpenter pick the cheapest current option.

My defaults:

  • Prod stateless: expireAfter: 720h (30 days)
  • Stateful or DBs: expireAfter: 2160h (90 days)
  • Spot-heavy: expireAfter: 168h (7 days)

5. terminationGracePeriod

The pod-level setting Karpenter respects when draining. The default is whatever your pod spec says, which is typically 30 seconds. That is wrong for most services with active connections.

For services with long-lived connections (gRPC, WebSocket, long polling, large file transfers), set terminationGracePeriodSeconds to at least 60 to 120 seconds at the pod level. Karpenter will honor it during consolidation drain.

For database pods or stateful workloads, use 300+ seconds and pair with a proper PreStop hook that signals the load balancer to remove the endpoint before the SIGTERM lands.

6. NodePool requirements and weights

The shape of your fleet matters as much as the consolidation timing.

Pin the instance families that match your workload. A NodePool that says "any instance" lets Karpenter pick a t3a.xlarge (burstable) for a sustained CPU workload, which throttles and then forces consolidation as Karpenter notices the CPU starvation. Pin to m7i, c7i, m8g (Graviton4), or similar based on actual workload shape.

Use NodePool weights to express preference. A weight: 100 for Graviton and weight: 10 for x86 tells Karpenter to try Graviton first and fall back to x86 only when needed. This is the cleanest way to drive a mixed-arch migration without forcing it.

Cap the maximum node size with node.kubernetes.io/instance-type constraints if your workload's largest pod is small. Without this, Karpenter will sometimes pick a c7i.4xlarge when a c7i.large would do, because the consolidation math looked at total spend, not per-pod fit.

Common tuning pitfalls

The three failures I see most often.

Setting consolidateAfter too low. Causes a feedback loop where workloads churn between nodes faster than they stabilize. Symptoms: pods restart every 5 to 10 minutes. Fix by raising to at least 5 minutes.

Skipping disruption.budgets for known events. A planned deploy plus default 10% disruption budget can cause a wave of consolidation right when the new deployment is rolling out. Set a deploy-window budget of 0% via cron.

Disabling consolidation entirely. I see this on stateful clusters as the easy answer. It doubles the cost over a quarter. Tune WhenEmpty plus a long consolidateAfter instead.

Where Karpenter tuning still falls short

The honest part.

Spot interruption is opaque. Karpenter can replace spot capacity proactively when AWS signals an interruption, but it does not know that a particular m7i.large pool is hot until it is. For workloads sensitive to spot churn, layer in mixed-instance pools with on-demand fallback.

The math is not multi-cluster aware. Each cluster optimizes locally. If you run dev and prod in the same account, you cannot use savings on one to fund headroom on the other without a manual policy.

No good defaults for AI workloads. GPU instances run for 8 hours then sit idle for 6. Karpenter's consolidation policy assumes utilization is a usable signal, and on GPUs it is mostly noise. Specialized GPU schedulers like KAI handle this better.

Frequently asked questions

Should I use Karpenter or the cluster autoscaler in 2026?
Karpenter for almost everything. The cluster autoscaler still has a niche in air-gapped or single-AZ deployments, but for most teams Karpenter is the default.

Is WhenEmptyOrUnderutilized safe for production?
Yes, with PDBs configured. The risk is not the policy, it is undeclared disruption tolerance at the workload level. Set maxUnavailable and minAvailable PDBs first.

How do I see what Karpenter is about to consolidate?
kubectl get nodeclaims -o wide shows the live picture. The Karpenter logs at debug level surface the consolidation math. Some commercial tools wrap this into a UI with a blast-radius preview before action.

Do these settings work the same on GKE Karpenter and Azure Karpenter?
Roughly yes, since they share the same Karpenter core. Cloud-specific instance type names and capacity-type values differ. The semantic settings are identical.

What about disruption.terminationGracePeriod at the NodePool level?
New in Karpenter 1.3. Sets a node-level grace floor. Useful for clusters where pod-level grace periods are inconsistent. I set it to 120s on most NodePools as a safety net.

What is your current Karpenter setup doing to your bill?

If you have not changed the consolidation defaults since adopting Karpenter, the question worth asking is whether your fleet rotates more often than your deploys. Drop your consolidateAfter value in the comments. I will tell you whether it is leaving money on the table or chasing every dollar at the cost of stability.