0

Update a Kubernetes cluster

by
Published Oct 17, 2025

Updates a 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
 * Update a Kubernetes cluster
7
 * Updates a Kubernetes cluster.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  clusterId: string,
13
  body: {
14
    control_plane?: {
15
      acl?: {
16
        addresses?: { ipv4?: string[]; ipv6?: string[] };
17
        enabled?: false | true;
18
        "revision-id"?: string;
19
      };
20
      high_availability?: false | true;
21
    };
22
    k8s_version?: string;
23
    label?: string;
24
    tags?: string[];
25
  },
26
) {
27
  const url = new URL(
28
    `https://api.linode.com/${apiVersion}/lke/clusters/${clusterId}`,
29
  );
30

31
  const response = await fetch(url, {
32
    method: "PUT",
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