# Node Pools

Node pools let you group worker nodes with the same configuration (flavor, volume size, GPU type) within a Kubernetes cluster. You can add, remove, and scale node pools independently.

***

## List

List all node pools for a cluster.

```bash
ace k8s cluster nodepool list <cluster-name-or-id>
```

You can also use the `--cluster` flag:

```bash
ace k8s cluster nodepool list --cluster my-cluster
```

**Aliases:** `ls`

**Example output:**

```
NAME                      ID                   NODES    FLAVOR       CLUSTER
pool1                     np-abc123            3        ACE.CPU.4C16R c-m-xyz789
gpu-pool                  np-def456            1        ACE.GPU.A100  c-m-xyz789
```

> **Note:** The node count is obtained by querying the nodes endpoint for each pool. If a cluster is still provisioning, node pools may not be available yet.

***

## Get / Show

Get detailed information about a specific node pool. Requires `--cluster`.

```bash
ace k8s cluster nodepool get <nodepool-name-or-id> --cluster <cluster-name-or-id>
```

**Aliases:** `show`

**Examples:**

```bash
ace k8s cluster nodepool get pool1 --cluster my-cluster
ace k8s cluster np show pool1 --cluster my-cluster
```

**Example output:**

```
  Name:                pool1
  ID:                  np-abc123
  Cluster:             c-m-xyz789
  Flavor:              ACE.CPU.4C16R
  Nodes:               3
  State:               active
  Volume:              50
  Autoscale:           1 - 5
```

***

## Create

Add a new node pool to an existing cluster.

```bash
ace k8s cluster nodepool create <cluster-name-or-id> \
  --name <pool-name> \
  --flavor <flavor-name-or-id> \
  [options]
```

You can also use `--cluster` instead of a positional argument:

```bash
ace k8s cluster nodepool create --cluster my-cluster --name pool2 --flavor ACE.CPU.4C16R
```

### Required Flags

| Flag       | Description                                                        |
| ---------- | ------------------------------------------------------------------ |
| `--name`   | Node pool name (lowercase alphanumeric with hyphens, max 63 chars) |
| `--flavor` | Flavor name or UUID for worker nodes                               |

### Optional Flags

| Flag               | Default | Description                         |
| ------------------ | ------- | ----------------------------------- |
| `--count`          | `1`     | Number of nodes (1-8)               |
| `--volume-size`    | `50`    | Volume size in GB per node (20-256) |
| `--security-group` |         | Security group UUID to attach       |
| `--gpu`            | `false` | Mark as GPU flavor                  |

### Examples

**Basic node pool:**

```bash
ace k8s cluster nodepool create my-cluster \
  --name pool2 \
  --flavor ACE.CPU.4C16R
```

**GPU node pool with custom volume:**

```bash
ace k8s cluster nodepool create my-cluster \
  --name gpu-pool \
  --flavor ACE.GPU.A100 \
  --count 2 \
  --volume-size 100 \
  --gpu
```

**With security group:**

```bash
ace k8s cluster nodepool create my-cluster \
  --name secure-pool \
  --flavor ACE.CPU.8C32R \
  --count 3 \
  --security-group <sg-uuid>
```

***

## Scale

Set a node pool's desired node count, kubectl-style.

```bash
ace k8s cluster nodepool scale <nodepool-id> \
  --cluster <cluster-name-or-id> \
  --count <target-node-count>
```

### Required Flags

| Flag        | Description                                            |
| ----------- | ------------------------------------------------------ |
| `--cluster` | Cluster name or ID                                     |
| `--count`   | **Target** number of nodes the pool should have (1-8). |

> **Behaviour change in v1.4.2-beta** — `--count` is now the **target node count**, not a delta. This mirrors `kubectl scale deployment foo --replicas=N`. The CLI reads the current node count, computes the add / remove delta automatically, and sends the right request to the backend.
>
> **Example:** If the pool currently has 1 node and you run `... --count 3`, the CLI adds 2. If the pool has 3 nodes and you run `... --count 1`, the CLI removes 2.

### Optional Flags

| Flag      | Description                                                                                                                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--delta` | Legacy mode — treat `--count` as a relative delta (`+N` to add, `-N` to remove). Provided for backward compatibility with scripts from older CLI versions. New scripts should use the default target-count semantics. |

### Examples

**Scale pool to 3 nodes (target count):**

```bash
ace k8s cluster nodepool scale pool1 \
  --cluster my-cluster \
  --count 3
```

**Scale back down to 1 node:**

```bash
ace k8s cluster nodepool scale pool1 \
  --cluster my-cluster \
  --count 1
```

**Legacy delta mode (add 2 nodes regardless of current size):**

```bash
ace k8s cluster nodepool scale pool1 \
  --cluster my-cluster \
  --count 2 --delta
```

***

## Delete

Delete a node pool from a cluster.

```bash
ace k8s cluster nodepool delete <nodepool-id> --cluster <cluster-name-or-id>
```

**Aliases:** `rm`

**Example:**

```bash
ace k8s cluster nodepool delete pool2 --cluster my-cluster
```

***

## Name Resolution

All node pool commands that accept a cluster reference support both **cluster names** and **cluster IDs**:

* If the value starts with `c-`, it is treated as a cluster ID
* Otherwise, the CLI lists all clusters and matches by name

Similarly, node pool `get` accepts either the pool name (`hostnamePrefix`) or pool ID.

***

## Global Flags

| Flag            | Description                                |
| --------------- | ------------------------------------------ |
| `-o, --output`  | Output format: `table` (default) or `json` |
| `-v, --verbose` | Show full JSON response                    |
| `--project`     | Override project ID                        |
| `--region`      | Override region                            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acecloud.ai/knowledge-base/cli/kubernetes/node-pools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
