oblivion
BlogsPortfolioContact
cloud Dispatch13 min read

Karpenter Isn't Scaling Down Your Kubernetes Cluster: A Deep Dive into Node Consolidation Failures

A practical SRE investigation into Kubernetes nodes that refuse to scale down. Explore Karpenter consolidation, NodeClaims, PodDisruptionBudgets, scheduling constraints, disruption budgets, and node termination.

idle Nodes12 nodes
simulated Savings42% compute cost
consolidation Delay30s
resolutionPDB realignment & disruption window tuning

The mystery of the 12 nodes that refused to disappear

One of the interesting problems in Kubernetes infrastructure is not always scaling up. Sometimes the more expensive problem is getting the cluster to scale down.

Imagine a cluster where application deployments have been deleted, workloads have reduced significantly, and only a handful of pods remain.

You expect Karpenter to identify unused capacity and terminate unnecessary EC2 instances.

But nothing happens.

The Kubernetes cluster continues running with approximately 12 worker nodes, even though the actual workload no longer justifies that capacity.

You check the NodePool configuration. Consolidation is enabled. The policy is set to WhenEmptyOrUnderutilized. The consolidation delay is configured to just 30 seconds.

Everything looks correct at first glance.

So why are the nodes still running?

This investigation explores the mechanisms behind Karpenter consolidation and provides a systematic troubleshooting approach to identify why apparently idle nodes are not being removed.

Important: This is an investigation-led technical case study based on the observed cluster symptoms and configuration context. The exact production root cause must be established from the corresponding Kubernetes events, NodeClaims and Karpenter controller logs.

1. Incident Overview

What we observed

The investigation involved two Kubernetes environments:

EnvironmentObservation
TESTCluster remained overprovisioned despite a significant reduction in workloads
E2EWorkload count was extremely low, but approximately 12 nodes remained active

The relevant NodePool configuration contained:

YAML
disruption:
  consolidationPolicy: WhenEmptyOrUnderutilized
  consolidateAfter: 30s

The environment was using Karpenter v1.12.1.

A scheduled configuration was also present:

TEXT
0 7,19 * * *

The schedule needs to be interpreted in the context of the complete NodePool disruption-budget configuration. A cron schedule in a disruption budget controls when that budget applies; it does not independently schedule a consolidation job.

Initial questions

We needed to establish:

  1. Were the nodes actually managed by Karpenter?
  2. Were there any remaining workload pods?
  3. Were DaemonSets or system workloads occupying the nodes?
  4. Were PodDisruptionBudgets preventing eviction?
  5. Were scheduling constraints preventing pods from moving?
  6. Were NodePool disruption budgets restricting consolidation?
  7. Was Karpenter identifying candidates but failing to execute termination?

The distinction matters: a node that is not considered for consolidation requires a different investigation from a node that has already entered the disruption process but cannot complete draining.

2. Understanding How Karpenter Consolidation Works

Karpenter is not simply a CPU-based autoscaler.

It continuously evaluates the relationship between workloads, available capacity, scheduling constraints and infrastructure cost.

When it identifies an opportunity to reduce capacity, it attempts to determine whether existing workloads can be accommodated on fewer or cheaper nodes.

There are two important consolidation outcomes:

  • Deletion: A node can be removed because its workloads can fit on existing available capacity.
  • Replacement: A node can be replaced with a more cost-effective instance configuration when the scheduling and pricing simulation permits it.

This means that an apparently idle node is not necessarily eligible for termination.

Consolidation lifecycle

Technical Architecture FlowMermaid.js
Rendering architectural diagram...
Figure 1: Karpenter Node Consolidation Lifecycle and Decision Gates
Download .excalidrawExcalidraw Vector
Workloads scale downPods are deleted /rescheduledKarpenter observesNode + NodeClaim stateCandidate evaluationEmpty / underutilized?Scheduling simulationCan every pod fit elsewhere?Disruption gatesBudgets • PDB •do-not-disruptTermination flowCordon → drain → clouddeleteNo consolidationInvestigate blocker /retryNode removedNodeClaim + EC2 instance goneImportant: consolidateAfter is an eligibility delay, not a guaranteed deletion timer.

The important point is that consolidation is a multi-stage process.

A failure or restriction at any stage can prevent the node from disappearing.

3. First Investigation: Verify Karpenter Ownership

Before investigating consolidation policies, establish whether Karpenter actually owns the nodes.

Karpenter-managed nodes normally expose ownership-related labels and annotations.

Start with:

BASH
kubectl get nodes \
  -L karpenter.sh/nodepool \
  -L karpenter.sh/capacity-type

Inspect the NodeClaims:

BASH
kubectl get nodeclaims -o wide

NodeClaims represent Karpenter's cloud capacity requests and provide another important view of the relationship between Kubernetes Nodes and cloud instances.

Inspect an individual NodeClaim:

BASH
kubectl describe nodeclaim <nodeclaim-name>

Look for:

  • NodePool ownership.
  • Node initialization conditions.
  • Provider ID.
  • Resource capacity.
  • Disruption-related conditions.
  • Termination state.

Also inspect the NodePool:

BASH
kubectl get nodepool
kubectl describe nodepool <nodepool-name>

What are we trying to establish?

If the node is not managed by the expected NodePool, changing the consolidation configuration of that NodePool will not solve the problem.

Similarly, if a node has not completed initialization, Karpenter may not consider it eligible for automatic deprovisioning.

4. Second Investigation: Is the Node Actually Empty?

A common troubleshooting mistake is equating an empty application namespace with an empty Kubernetes node.

A node can have no application deployments and still run:

  • Fluent Bit.
  • Prometheus node exporters.
  • CNI components.
  • CSI components.
  • Security agents.
  • Other infrastructure DaemonSets.

List pods on a specific node:

BASH
NODE=<node-name>

kubectl get pods -A \
  --field-selector spec.nodeName="$NODE" \
  -o wide

Inspect node details:

BASH
kubectl describe node "$NODE"

Pay particular attention to:

  • Non-terminated pods.
  • Allocated CPU and memory requests.
  • Node taints.
  • Node conditions.
  • Scheduling restrictions.

Why DaemonSets matter

DaemonSet pods are generally handled specially during Karpenter's emptiness and termination evaluations. Their presence alone does not necessarily mean that a node cannot be consolidated.

However, they should not be ignored.

For example, a security agent may run on every worker node, while an application pod may be the actual workload preventing consolidation.

The investigation must distinguish between infrastructure-managed pods and ordinary workloads.

5. Third Investigation: PodDisruptionBudgets

This is one of the most important areas to investigate.

A PodDisruptionBudget (PDB) protects application availability during voluntary disruptions.

Suppose an application has five replicas:

YAML
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: checkout-pdb
spec:
  minAvailable: 5
  selector:
    matchLabels:
      app: checkout

The PDB requires all five replicas to remain available.

If a node contains one of these replicas, Karpenter may be unable to evict it without violating the budget.

The node therefore cannot complete its voluntary disruption.

Check all PDBs:

BASH
kubectl get pdb -A

Inspect the relevant PDB:

BASH
kubectl describe pdb checkout-pdb -n production

Check:

  • Allowed disruptions.
  • Current healthy replicas.
  • Desired healthy replicas.
  • Matching pods.

A particularly important condition is:

TEXT
ALLOWED DISRUPTIONS: 0

This is a strong indication that eviction may be blocked.

However, the PDB must actually select the pod on the candidate node before attributing the blockage to it.

A second blocker: do-not-disrupt

Karpenter also supports the pod annotation:

YAML
metadata:
  annotations:
    karpenter.sh/do-not-disrupt: "true"

This annotation protects a pod from Karpenter's voluntary disruption process.

A node containing a pod with an active do-not-disrupt annotation may therefore remain unavailable for consolidation.

Find annotated pods:

BASH
kubectl get pods -A -o json | jq -r '
.items[]
| select(.metadata.annotations["karpenter.sh/do-not-disrupt"] != null)
| [
    .metadata.namespace,
    .metadata.name,
    .spec.nodeName,
    .metadata.annotations["karpenter.sh/do-not-disrupt"]
  ]
| @tsv'

Do not remove these annotations blindly. First establish why the application requires disruption protection.

6. Fourth Investigation: Scheduling Constraints

A node may have very low resource utilization and still be impossible to consolidate.

Why?

Because Karpenter needs to establish that the existing pods can run somewhere else.

Consider the following example:

YAML
affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app: payment
        topologyKey: kubernetes.io/hostname

This configuration requires matching payment pods to run on different nodes.

If the remaining nodes cannot satisfy this requirement, Karpenter cannot safely consolidate the candidate node.

Other important scheduling restrictions include:

  • Node affinity.
  • Pod affinity.
  • Pod anti-affinity.
  • Topology spread constraints.
  • Taints and tolerations.
  • Persistent volume topology.
  • Available CPU and memory requests.
  • Instance type and architecture requirements.

Example: Why low CPU utilization is misleading

Consider this hypothetical cluster:

NodeCPU requestedMemory requestedWorkloads
Node A8%12%Payment API
Node B7%10%Payment API
Node C5%9%Payment API

All three nodes appear underutilized.

But if required anti-affinity forces each payment API replica onto a different hostname, Karpenter cannot simply place all three replicas on one node.

The scheduling simulation determines whether consolidation is possible.

CPU utilization alone cannot answer that question.

7. Fifth Investigation: NodePool Disruption Budgets

Even when a node is a valid consolidation candidate, NodePool disruption budgets can restrict how many nodes Karpenter may disrupt.

Example:

YAML
spec:
  disruption:
    budgets:
      - nodes: "10%"

A budget of 10% limits simultaneous voluntary disruptions relative to the NodePool's node population, subject to Karpenter's budget calculation.

Multiple budgets can apply simultaneously. The most restrictive applicable budget wins.

Scheduled disruption budgets

A configuration can also contain a schedule:

YAML
spec:
  disruption:
    budgets:
      - nodes: "0"
        schedule: "0 7,19 * * *"
        duration: 30m
        reasons:
          - Underutilized

This example blocks underutilized-node disruptions during the configured scheduled windows.

It is important to understand what this means:

  • The schedule controls when the budget is active.
  • The duration defines the active period.
  • The nodes field defines the disruption allowance.
  • The reasons field determines which disruption reasons the budget applies to.

A schedule is not a command telling Karpenter to scale down at 07:00 and 19:00.

For the actual environment, inspect the complete NodePool YAML before deciding whether its schedule is blocking consolidation.

BASH
kubectl get nodepool <nodepool-name> -o yaml

Inspect the entire spec.disruption section, not just the cron expression.

8. Sixth Investigation: The 30-Second Consolidation Delay

The configuration:

YAML
consolidateAfter: 30s

is easy to misunderstand.

It does not mean that Karpenter guarantees node termination 30 seconds after a workload is deleted.

It defines how long Karpenter waits after a pod is added to or removed from a node before considering that node for consolidation.

The timer can reset when pod placement changes.

After the delay, Karpenter still needs to:

  1. Identify a consolidation candidate.
  2. Simulate pod rescheduling.
  3. Evaluate disruption budgets.
  4. Respect eviction requirements.
  5. Execute the termination process.

Therefore:

30 seconds is an eligibility delay, not an end-to-end termination SLA.

Increasing or decreasing this value without understanding the actual blocker may have no effect.

9. Seventh Investigation: Karpenter Controller Logs and Events

This is where the investigation should move from assumptions to evidence.

Inspect Karpenter controller pods:

BASH
kubectl get pods -n karpenter

Read controller logs:

BASH
kubectl logs -n karpenter \
  deployment/karpenter \
  --since=1h

Filter relevant messages:

BASH
kubectl logs -n karpenter \
  deployment/karpenter \
  --since=1h \
  | grep -Ei 'consolidat|disrupt|blocked|pdb|nodeclaim|terminate'

Inspect cluster events:

BASH
kubectl get events -A \
  --sort-by=.lastTimestamp

Correlate the following:

  • Candidate identification.
  • Consolidation decision.
  • Scheduling simulation outcome.
  • Disruption budget evaluation.
  • Pod eviction attempts.
  • NodeClaim termination.
  • Cloud provider termination.

A message indicating that a node is not eligible for consolidation is very different from a message indicating that termination has started but draining is blocked.

The timestamps matter too. Correlate events with pod changes and controller logs rather than relying on a single snapshot.

10. Putting the Investigation Together

The following decision tree provides a repeatable approach.

Technical Architecture FlowMermaid.js
Rendering architectural diagram...

The investigation should stop treating the node as simply idle and start identifying exactly which lifecycle stage prevents its removal.

Do not immediately increase disruption aggressiveness or remove protection mechanisms.

Remediation should follow the evidence.

FindingRecommended action
Node not initializedResolve readiness, startup taints or missing expected resources
PDB blocks evictionReview replica availability and PDB configuration with application owners
do-not-disrupt annotationValidate whether protection is still required
Affinity prevents consolidationReview workload placement requirements
Budget restricts disruptionReview NodePool disruption-budget policy
Pod churn resets timerInvestigate recurring scheduling and deployment activity
No candidate identifiedReview controller logs, policy and scheduling simulation
NodeClaim termination incompleteInvestigate finalizers, drain state and cloud-provider lifecycle

Suggested operational hardening

  1. Establish monitoring for the number of Karpenter-managed nodes versus actual workload demand.
  2. Alert on prolonged node overprovisioning.
  3. Monitor NodePool disruption budgets.
  4. Review PDB configurations regularly.
  5. Audit long-lived do-not-disrupt annotations.
  6. Test consolidation behaviour in lower environments.
  7. Correlate NodeClaim lifecycle events with EC2 instance state.
  8. Keep controller logs available for incident investigation.

12. Operational Verification

After remediation, verify that the expected capacity reduction actually occurred.

BASH
kubectl get nodes -o wide
kubectl get nodeclaims -o wide
kubectl get nodepool

Verify workloads:

BASH
kubectl get pods -A -o wide

Verify that the cloud instances corresponding to terminated NodeClaims are no longer running.

Also monitor:

  • Pending pods.
  • Scheduling failures.
  • Node provisioning frequency.
  • Application availability.
  • CPU and memory requests.
  • Consolidation-related controller events.

A successful scale-down is not just a lower node count. It must preserve workload availability and leave sufficient capacity for expected demand.

13. Final Takeaways

Karpenter consolidation is a scheduling and disruption-management process, not a simple utilization threshold.

When a Kubernetes cluster retains unnecessary nodes, investigate the complete lifecycle:

  1. Node ownership and initialization.
  2. Actual workload placement.
  3. Consolidation eligibility.
  4. Scheduling feasibility.
  5. PDB and annotation restrictions.
  6. NodePool disruption budgets.
  7. Controller decisions and termination.

The most important lesson is this:

Never assume that Karpenter is broken just because an apparently idle node remains running. Find the exact stage where the consolidation lifecycle stops.

That is the difference between changing configuration until something works and conducting a proper SRE root-cause investigation.

---

References and Further Reading

Editorial note: Configuration examples are illustrative. Validate API fields, defaults and behaviour against the exact Karpenter version deployed in your cluster before applying them.

Referenced In & Suggested Next Reads

Bidirectionally cross-referenced across technical domains.