Kubernetes Cost Optimization With Karpenter

Updated

7 min read

Glass jar of coins beside a succulent on a wooden table, representing cloud spend
In this article
  1. Kubernetes cost optimization settings at a glance
  2. What to check before buying more savings
  3. 1. Set pod requests so the scheduler has accurate numbers
  4. 2. Choose a consolidation policy that matches the workload
  5. 3. Use disruption budgets and time windows
  6. 4. Spot capacity: the largest lever, with its own rules
  7. 5. Node expiry and NodePool limits
  8. 6. Protect the workloads that must not move
  9. Which one to pick by cluster type
  10. Frequently asked questions
  11. Does Karpenter reduce cost on its own?
  12. What is the safest first change?
  13. Can Spot nodes be replaced with cheaper Spot nodes?
  14. Why do pods stay pending after I set limits?

Kubernetes cost optimization with Karpenter comes down to five settings: pod resource requests, the NodePool consolidation policy, disruption budgets, Spot capacity, and node expiry. Karpenter removes or replaces nodes that are empty or under-used, so the savings depend on how accurately pods declare what they need and on which pods Karpenter is allowed to move. Start with the requests, then loosen consolidation one NodePool at a time.

This guide explains each lever, ranks no products, shows the default that the Karpenter documentation publishes for it, and lists the risks that the same documentation describes. Every setting and default below comes from the primary sources listed at the end, which were accessed on 2026-11-25.

Kubernetes cost optimization settings at a glance

LeverWhere it is setDefault in the Karpenter docsWhat it controls
Pod resource requestsPod specNot set by Karpenter; you set themThe scheduler uses requests to decide where a pod fits, so inaccurate requests produce nodes that are too big or too small
consolidationPolicyNodePool disruption blockWhenEmptyOrUnderutilizedWhich nodes Karpenter may remove or replace (WhenEmpty, Balanced or WhenEmptyOrUnderutilized)
consolidateAfterNodePool disruption block0sHow long a node waits after a pod is added or removed before consolidation; can be set to Never
budgetsNodePool disruption blockSet by you; the docs example uses 10%The speed of voluntary node removal, optionally limited to time windows
expireAfterNodePool templateDocs example: 720h; Never is allowedMaximum lifetime of a node before it is replaced
limitsNodePool specSet by youCaps the total CPU and memory a NodePool can use
karpenter.sh/do-not-disruptPod annotationNot setStops voluntary disruption of the node while the annotated pod runs

What to check before buying more savings

Three checks come before any change to a NodePool. Each one is a precondition, not a tuning option.

  • Requests match real use. Karpenter can only pack pods as tightly as their requests allow. Requests set far above actual use leave nodes idle, and requests set below actual use cause crowding and throttling.
  • Limits are understood. Kubernetes applies requests to scheduling and limits to enforcement. The kubelet enforces limits, so a limit does not reduce the node count the way a request does.
  • Disruption rules are written down. Pod disruption budgets, termination grace periods and do-not-disrupt annotations decide which workloads can move. Map them before you enable more consolidation.

1. Set pod requests so the scheduler has accurate numbers

The Kubernetes scheduler uses the resource request of each container to choose a node. The kubelet then enforces the limit on that node, and the Linux kernel makes the final call on memory and CPU limits. In practice, requests are the input that decides how many nodes a cluster needs. A cluster where every deployment asks for four CPUs and uses one will hold far more idle capacity than one with requests based on measured use.

2. Choose a consolidation policy that matches the workload

Consolidation is the process of removing or replacing nodes to lower cost. The consolidation policy decides which nodes Karpenter considers. The three options in the NodePool documentation are:

  • WhenEmpty considers only nodes with no workload pods. It is the least disruptive choice and captures the smallest saving.
  • Balanced considers the same nodes as WhenEmptyOrUnderutilized, but consolidates only when the estimated savings are worth the disruption to running pods.
  • WhenEmptyOrUnderutilized considers all nodes and removes or replaces those that are empty or could be changed to reduce cost. It is the default when the field is not set.

The consolidateAfter field adds a wait after each pod change. The default is 0s. The NodePool examples in the documentation use 1m, and the value Never turns consolidation off for that NodePool. A short wait helps when deployments scale up and down in bursts, because it stops Karpenter from replacing a node that is about to receive pods again.

3. Use disruption budgets and time windows

Budgets limit how many nodes Karpenter can disrupt at once. Karpenter follows the smallest value among the active budgets and rounds percentages up. The documentation example sets nodes: "10 %" for normal operation, then adds a window that blocks all voluntary disruption on weekday business hours: a schedule of 0 9 * * mon-fri, a duration of 8h, and nodes: "0". Duration and schedule must be set together.

A budget is the right tool when a cluster runs a steady API workload and a change window matters more than the last few percent of savings. It is the wrong tool for a batch cluster that has no peak hours, where a plain percentage is simpler to reason about.

4. Spot capacity: the largest lever, with its own rules

AWS states that Spot Instances are available at up to 90% off compared with On-Demand prices, and it updates Spot prices every five minutes on its pricing page. The range is a ceiling, not a forecast: the discount on a given instance type and zone changes over time, and the AWS Spot Instance Advisor shows the current comparison.

The Karpenter documentation describes three behaviours that matter for Spot:

  • For Spot nodes, deletion consolidation is enabled by default. Karpenter removes an under-used Spot node without launching a replacement.
  • Replacing a Spot node with a cheaper Spot node, which is spot-to-spot consolidation, needs the SpotToSpotConsolidation feature flag.
  • Karpenter selects the lowest-priced Spot type with the price-capacity-optimized strategy. The documentation notes that the lowest-priced type is sometimes not launched because of capacity.

The practical consequence is to keep stateful and latency-sensitive services on On-Demand NodePools, and to put interruption-tolerant workloads such as batch jobs, workers and build agents on a separate Spot NodePool. Keeping the two apart lets each one use its own disruption settings.

5. Node expiry and NodePool limits

expireAfter sets the maximum lifetime of a node. The documentation example uses 720h (30 days), and Never turns expiry off. A node that passes its lifetime is drained right away. Changing the value on a NodePool does not change existing nodes directly; it causes drift, so replacements start with the new value. That makes expiry a useful way to pick up new AMIs and instance types, and a way to create a wave of replacements if the value is changed on a large NodePool at once.

limits caps the total CPU and memory a NodePool can use. When the limit is reached, Karpenter stops provisioning from that NodePool. When several NodePools exist, Karpenter tries the one with the highest weight first and falls back to lower-weight NodePools if the higher one cannot be used, including when its limits are reached. A limit is a guardrail for spend, but a limit set too low causes pods to stay pending.

6. Protect the workloads that must not move

Consolidation is only safe when the pods on a node can be moved. Kubernetes gives application owners a PodDisruptionBudget (PDB) to limit how many replicas of an application are down at once during voluntary disruption. Karpenter respects the PDB when it drains a node.

The Karpenter documentation says that PDBs and the karpenter.sh/do-not-disrupt annotation are respected during draining until the NodePool’s terminationGracePeriod is reached, after which the pods are forcibly deleted. It also warns that a do-not-disrupt pod can block draining indefinitely. The safe pattern is to annotate only the few pods that truly cannot move, set a termination grace period on the NodePool, and check that each PDB still allows at least one eviction during a drain.

Which one to pick by cluster type

For a small development or staging cluster, start with the defaults, set requests on every deployment, and cap spend with limits. Consolidation with the default WhenEmptyOrUnderutilized policy is low risk when no workload is stateful.

For a production cluster that serves users during set hours, use Balanced or WhenEmpty, add a budget that blocks disruption in peak windows, and keep On-Demand for the services that cannot tolerate interruption.

For a batch or data-processing cluster, Spot capacity gives the largest saving. Use a Spot NodePool with a low-priority weight for fallback, and set expiry so that long-running nodes are refreshed.

Frequently asked questions

Does Karpenter reduce cost on its own?

Karpenter removes and replaces nodes that are empty or under-used, under the consolidation policy you set. Its default policy is WhenEmptyOrUnderutilized with a zero-second wait. The saving depends on accurate pod requests and on the workloads that are allowed to move.

What is the safest first change?

Correct the resource requests on the largest deployments, then set a consolidation policy that matches the workload. Changing budgets and expiry comes after the requests are correct.

Can Spot nodes be replaced with cheaper Spot nodes?

Yes, but only with the SpotToSpotConsolidation feature flag. By default Karpenter removes under-used Spot nodes without replacing them.

Why do pods stay pending after I set limits?

When a NodePool reaches its CPU or memory limit, Karpenter stops provisioning from it. Check the NodePool status and raise the limit, or add a lower-weight NodePool as a fallback.

About the author

Equipe Gui Tech

68 articles published

The Gui Tech team researches, verifies and updates every guide with verifiable sources. Enterprise tech, AI and security explained.

All articles

Keep reading