Create a Kubernetes cluster

Create a cluster with its control plane and workers. Leave out node_pools, or send an empty list, to create a cluster without workers.

POST https://{availability_zone}.betterstackcloud.com/v1/kubernetes-clusters
Authorization string required

Bearer $TOKEN

Content-Type string

application/json

team_id string required

The ID of the team that owns the cluster. betterstack team list shows it.

name string required

The cluster's name, up to 255 characters. Must be unique among the organization's clusters that aren't failed or destroyed.

version string

The Kubernetes version as major and minor number, such as 1.36. List the versions with betterstack kubernetes-version list. Defaults to the newest version.

pod_cidr string default: 10.42.0.0/16

The IPv4 range for pods. Can't overlap service_cidr, the range we use for the cluster, or a network you attach. Can't be changed later.

service_cidr string default: 10.43.0.0/16

The IPv4 range for Kubernetes services. Can't overlap pod_cidr, the range we use for the cluster, or a network you attach. Can't be changed later.

api_allowed_cidrs array of strings or null default: ["0.0.0.0/0", "::/0"]

The IP ranges allowed to reach the cluster's Kubernetes API, as 1 to 50 IPv4 or IPv6 CIDRs. Leave it out, or send null, to allow every address.

network_ids array of strings

The IDs of private networks of the cluster's team to attach to the cluster.

firewall_ids array of strings

The IDs of firewalls to attach to the workers.

node_pools array of objects default: []

The cluster's node pools, up to 10, with up to 100 workers in total. Workers are servers, so server types and server quotas apply to them.

node_pools[].name string required

The node pool's name, unique in the cluster. Up to 30 lowercase letters, digits and hyphens, starting and ending with a letter or digit.

node_pools[].server_type string required

The server type of the workers. List the server types with betterstack server-type list.

node_pools[].node_count integer default: 1

How many workers the node pool should have, from 0 to 100. A cluster can have 100 workers in total.

node_pools[].labels object or null

The Kubernetes labels of the workers, up to 10 string pairs. Keys and values have up to 63 characters. Accepts any keys.

node_pools[].taints array of objects or null

The Kubernetes taints of the workers, up to 10.

node_pools[].taints[].key string required

The taint's key, in the form of a Kubernetes label key.

node_pools[].taints[].value string or null

The taint's value, up to 63 characters.

node_pools[].taints[].effect string required

What the taint does to pods that don't tolerate it, as in Kubernetes. Possible values: NoSchedule, PreferNoSchedule, NoExecute.

metadata object or null

Your own tags, up to 10 string pairs. The keys kubernetes-cluster, kubernetes-node-pool and kubernetes-service-uid are reserved for Better Stack and can't be set. Accepts any keys.

202 Accepted
{
  "id": "example",
  "name": "Example Kubernetes cluster",
  "version": "1.4.2",
  "patch_version": "1.4.2",
  "available_versions": [
    "1.4.2"
  ],
  "status": "provisioning",
  "status_message": "example",
  "endpoint": {
    "hostname": "proxy.example.com",
    "port": 6443,
    "api_allowed_cidrs": [
      "example"
    ]
  },
  "pod_cidr": "10.42.0.0/16",
  "service_cidr": "10.43.0.0/16",
  "nodes_ready": 1,
  "nodes_total": 1,
  "node_pools": [
    {
      "id": "example",
      "name": "Example",
      "server_type": "example",
      "node_count": 50,
      "labels": {
        "example": "value"
      },
      "taints": [
        {
          "key": "example",
          "value": "example",
          "effect": "NoSchedule"
        }
      ],
      "status": "active",
      "status_message": "example",
      "nodes_ready": 1,
      "scaling": {
        "from": 1,
        "to": 1,
        "started_at": "2026-07-01T12:00:00.000Z",
        "estimated_ready_at": "2026-07-01T12:00:00.000Z"
      },
      "nodes": [
        {
          "id": "example",
          "name": "Example",
          "server_id": "123456789",
          "status": "queued",
          "version": "1.4.2",
          "last_seen_at": "2026-07-01T12:00:00.000Z"
        }
      ]
    }
  ],
  "network_ids": [
    "123456789"
  ],
  "firewall_ids": [
    "123456789"
  ],
  "kubeconfig_rotated_at": "2026-07-01T12:00:00.000Z",
  "latest_snapshot_at": "2026-07-01T12:00:00.000Z",
  "created_at": "2026-07-01T12:00:00.000Z",
  "updated_at": "2026-07-01T12:00:00.000Z",
  "team_id": "t123",
  "metadata": {
    "example": "value"
  }
}

Returns the newly created Kubernetes cluster.

id string

The cluster's ID, a UUID.

name string

The cluster's name, up to 255 characters.

version string

The Kubernetes version as major and minor number, such as 1.36. Defaults to the newest version.

patch_version string or null

The exact Kubernetes build we installed for version, such as v1.37.2+k3s1.

available_versions array of strings

The versions you can upgrade the cluster to now. Holds the next minor version once we offer it.

status string

The state of the cluster's control plane. The cluster is ready when it's running and every node pool has node_count workers that are all ready.
Valid values:
provisioning: We're creating the control plane and the workers.
running: The control plane works. Check node_pools to see whether the workers are ready.
degraded: The control plane or some workers aren't healthy. status_message says which.
upgrading: We're upgrading the control plane and then the workers.
restoring: We're restoring the control plane from a snapshot.
failed: We couldn't create the cluster. status_message says why.
destroyed: The cluster is deleted.

status_message string or null

What went wrong while creating, scaling or running the cluster, or null.

endpoint object

Where to reach the cluster's Kubernetes API, and from which IP ranges.

endpoint.hostname string or null

The host name of the Kubernetes API.

endpoint.port integer

The port of the Kubernetes API, always 6443. Always 6443.

endpoint.api_allowed_cidrs array of strings

The IP ranges allowed to reach the cluster's Kubernetes API, as 1 to 50 IPv4 or IPv6 CIDRs.

pod_cidr string

The IPv4 range for pods.

service_cidr string

The IPv4 range for Kubernetes services.

nodes_ready integer

How many workers were ready when we last checked.

nodes_total integer

How many workers the cluster has now. Each node pool's node_count says how many it should have.

node_pools array of objects

The cluster's node pools, sorted by name, each with its workers. Deleted node pools aren't listed.

node_pools[].id string

The node pool's ID, a UUID.

node_pools[].name string

The node pool's name.

node_pools[].server_type string

The server type of the workers.

node_pools[].node_count integer

How many workers the node pool should have.

node_pools[].labels object

The Kubernetes labels of the workers, as string pairs.

node_pools[].taints array of objects

The Kubernetes taints of the workers.

node_pools[].taints[].key string

The taint's key.

node_pools[].taints[].value string or null

The taint's value, or null when the taint has none.

node_pools[].taints[].effect string

What the taint does to pods that don't tolerate it, as in Kubernetes. Possible values: NoSchedule, PreferNoSchedule, NoExecute.

node_pools[].status string

The node pool's state. A node pool that's active can still have workers that aren't ready. Possible values: active, scaling, deleting, destroyed.

node_pools[].status_message string or null

Why the node pool has fewer workers than node_count, or null.

node_pools[].nodes_ready integer

How many workers of the node pool are ready.

node_pools[].scaling object or null

How a change of size is going while the node pool is scaling, or null otherwise.

node_pools[].scaling.from integer or null

The number of workers before the change.

node_pools[].scaling.to integer

The node_count to reach.

node_pools[].scaling.started_at datetime

When the change started. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

node_pools[].scaling.estimated_ready_at datetime

When we expect the change to be done. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

node_pools[].nodes array of objects

The node pool's workers.

node_pools[].nodes[].id string

The worker's ID.

node_pools[].nodes[].name string

The worker's name in Kubernetes.

node_pools[].nodes[].server_id string or null

The ID of the server that runs the worker, or null while the worker is queued.

node_pools[].nodes[].status string

The worker's state. Possible values: queued, provisioning, joining, ready, not_ready, draining, replacing, destroyed.

node_pools[].nodes[].version string or null

The Kubernetes version the worker reports.

node_pools[].nodes[].last_seen_at datetime or null

When we last saw the worker ready. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

network_ids array of strings

The IDs of the private networks attached to the cluster. The list is empty while the cluster has no workers. Order doesn't matter.

firewall_ids array of strings

The IDs of the firewalls attached to the workers. The list is empty while the cluster has no workers. Order doesn't matter.

kubeconfig_rotated_at datetime or null

When the admin credentials of the kubeconfig were first issued or last rotated, or null before they're issued. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

latest_snapshot_at datetime or null

When the newest available snapshot of the control plane was created, or null when there is none. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

created_at datetime

When the cluster was created. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

updated_at datetime

When the cluster was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

team_id string

The ID of the team that owns the cluster. betterstack team list shows it.

metadata object

Your own tags, up to 10 string pairs.