0

Update a node pool

by
Published Oct 17, 2025

Updates a node pool's count, labels and taints, and autoscaler configuration.

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update a node pool
7
 * Updates a node pool's count, labels and taints, and autoscaler configuration.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  clusterId: string,
13
  poolId: string,
14
  body: {
15
    autoscaler?: { enabled?: false | true; max?: number; min?: number };
16
    count?: number;
17
    labels?: {};
18
    taints?: {
19
      effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute";
20
      key: string;
21
      value: string;
22
    }[];
23
  },
24
) {
25
  const url = new URL(
26
    `https://api.linode.com/${apiVersion}/lke/clusters/${clusterId}/pools/${poolId}`,
27
  );
28

29
  const response = await fetch(url, {
30
    method: "PUT",
31
    headers: {
32
      "Content-Type": "application/json",
33
      Authorization: "Bearer " + auth.token,
34
    },
35
    body: JSON.stringify(body),
36
  });
37
  if (!response.ok) {
38
    const text = await response.text();
39
    throw new Error(`${response.status} ${text}`);
40
  }
41
  return await response.json();
42
}
43