0

Create a node pool

by
Published Oct 17, 2025

Creates a new Node Pool for the designated Kubernetes cluster.

Script linode Verified

The script

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

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