# Change a node group

Scale a node group, change its server type, labels, taints or zones, and restart a group that stopped after failed nodes.

Replace _my-cluster_ with your cluster's name or id, and _workers_ with the node group's name.

## Prerequisites

- Permission for `eks:UpdateNodegroupConfig` on the node group.
- In the console, also `eks:DescribeCluster` and `eks:ListNodegroups`. The console enables
  **Edit** only with `eks:UpdateNodegroupConfig` on every cluster (`eks:*`).

## Change the node group

**Console**
1. Open **Kubernetes**, open the cluster, then choose **Node groups**.
2. On the node group's row, choose **Edit**.
3. Change the **Server type**, **Minimum**, **Desired** and **Maximum**, **Autoscaling**, the labels
   and the taints as needed.
4. Choose **Save**.

**CLI**
```sh
dcloud eks nodegroups update my-cluster workers --desired-size 3
```

**API**
```http
PATCH /eks/api/clusters/my-cluster/nodegroups/workers
{ "desiredSize": 3 }
```

**Terraform**
Change `desired_size` (or `min_size`, `max_size`, `instance_type`, `labels`, `taints`, `zones`) on
the `dcloud_eks_nodegroup` and apply.

## What each change does

- **Sizes** are checked together with the ones you do not send: `minSize ≤ desiredSize ≤ maxSize`.
  Only a larger `maxSize` is checked against the quotas; shrinking is always allowed.
- **Scaling down** removes nodes that are not Ready first, then nodes on an older minor, then the
  newest. A Ready node is drained first: PodDisruptionBudgets are respected for up to five minutes
  per node, then the node goes anyway. A node that is not Ready is removed without a drain.
- **Server type** applies to nodes created from then on; nodes already running keep theirs until
  they are replaced.
- **Labels** and **taints** replace the lists as a whole (`{}` and `[]` remove them all), and apply
  to nodes created from then on.
- **Zones** apply to nodes created from then on; nothing moves.
- A group in status `failed` (stopped after three failed nodes) goes `updating` on any change and
  tries again.

Each change is recorded in **Activity**.

## Refusals

- `400` "Sizes must satisfy minSize ≤ desiredSize ≤ maxSize (would be …)", "Nothing to change", or a
  type or zone that cannot be used.
- `404` when the node group does not exist.
- `409` "The node group is being deleted", or a larger `maxSize` passes a quota ("Quota exceeded: …").

## Related

- [Turn on autoscaling](turn-on-autoscaling.md)
- [Upgrade a node group](upgrade-a-node-group.md)
- `eks.nodegroups.update` · `dcloud eks nodegroups update` · `dcloud_eks_nodegroup`
