> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costgraph.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Karpenter node pools

> How CostGraph AutoPilot creates its own Karpenter NodePools and proposes changes to yours.

When a workload is cheaper on a different kind of node, CostGraph can place it
there. Which path it takes depends on who owns the node pool.

| Pool | What CostGraph does |
| - | - |
| A NodePool CostGraph created | Creates, updates and deletes it automatically. |
| Your own NodePool, node group or compute class | Never edits it. Suggested changes arrive as a pull request. |

## Pools CostGraph creates

CostGraph creates a NodePool when splitting an existing pool saves money, for
example moving workloads that need less memory off a pool sized for memory-heavy
ones. It is off by default.

```bash theme={null}
helm upgrade costgraph-operator costgraph/costgraph-operator \
  --reuse-values \
  --set global.autopilot.enabled=true \
  --set global.autopilot.ownedNodePools.enabled=true
```

Turning this on grants the operator permission to manage `karpenter.sh`
NodePools. It is not granted otherwise.

A pool created by CostGraph:

* Is labelled `costgraph.ai/managed: "true"`.
* Is copied from the pool it splits, including its node class, so it launches the same kind of nodes.
* Carries the label and taint `costgraph.ai/pool` in its node template. Only workloads steered to the pool run on it.
* Has weight 50 so Karpenter prefers it for the workloads steered to it.
* Sets a node termination grace period (24h unless the source pool sets one).

Workloads reach the pool only when they set `autopilot.costgraph.ai/placement: auto`.
Their pods then get a matching toleration and node selector, but only while the
pool exists in the cluster. Existing tolerations and node selectors are kept, and
a pod that already selects a different `costgraph.ai/pool` is left alone. For GPU workloads, the owned pool is created from a
pool that already runs GPU nodes.

### Safety

* Only the `karpenter.sh/v1` API is supported. On other versions CostGraph shows recommendations and YAML only.
* Before every write, the change is checked against the Karpenter version installed in your cluster with a dry run. If it does not fit, nothing is applied and the pool shows why, with the YAML for review.
* A pool you created with the same name is never touched. CostGraph reports the conflict instead.
* Changing a pool's node template replaces every node in it. CostGraph changes the template of a pool at most once every 7 days, and only for a material change. Weight, limits and disruption settings are updated freely because they do not replace nodes.
* When a proposal goes away, CostGraph stops steering new pods to the pool first. It deletes the pool only after the proposal has been gone for three polls and no running or pending pod selects the pool.

Set `global.autopilot.ownedNodePools.enabled=false` to stop creating and changing pools, or `global.autopilot.paused=true` to pause everything.

## Your own pools

CostGraph never edits a NodePool that it did not create. Suggested changes, such
as widening instance families, consolidation or disruption budgets, are opened as
a pull request in your repository through [workflows](https://docs.costgraph.ai/costgraph/workflows/what-workflows-can-change.md#pull-requests).

Node groups, managed pools and compute classes on other platforms get
recommendations and pull requests only. A pool that can launch only one machine
type still limits sizing: AutoPilot never sets a request larger than the biggest
node the workload's pool can launch.

## Savings from node changes

Karpenter does not yet count in-place resizes when it consolidates nodes. Node
savings from a smaller request therefore land when pods are recreated. The
workload's node cost drops only once nodes are replaced, and realised savings
are measured rather than assumed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.