Skip to content

Kubernetes Clusters

The b'nerd platform supports two cluster types, distinguished by the kind field:

Kind Description
gardener Managed clusters provisioned and operated by Gardener. b'nerd handles the control plane.
generic Clusters you bring yourself — register an existing cluster by providing a kubeconfig.

Kubernetes: enabled on request, then self-service

b'nerd enables Kubernetes for a project on request (how to request it). After that you create, update and delete clusters and download their kubeconfig yourself with the endpoints below. Before that, POST /k8s/clusters for a Gardener-managed cluster is refused, for example with 422 kubernetes_not_provisioned.

Endpoints

Method Path Description
GET /k8s/clusters?project_id=<uuid> List clusters in a project
POST /k8s/clusters?project_id=<uuid> Create a cluster
GET /k8s/clusters/{id}?project_id=<uuid> Show a cluster
PATCH /k8s/clusters/{id}?project_id=<uuid> Update a cluster
DELETE /k8s/clusters/{id}?project_id=<uuid> Delete a cluster
GET /k8s/clusters/{id}/kubeconfig?project_id=<uuid> Download kubeconfig for a connected Gardener cluster
GET /k8s/cloudprofiles List Gardener cloud profiles (available regions/versions)

project_id is required on all cluster requests.

List clusters

GET /k8s/clusters?project_id=<uuid>
Authorization: Bearer <token>

Returns both Gardener-managed and generic clusters in one array. Use the kind field to differentiate.

Create a Gardener-managed cluster

POST /k8s/clusters?project_id=<uuid>
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "prod-cluster",
  "project_id": "<uuid>",
  "version": "1.29",
  "node_pools": [
    {
      "name": "workers",
      "machine": { "type": "m1.large" },
      "minimum": 2,
      "maximum": 5
    }
  ]
}

Add "region": "<region>" to the body to choose where the cluster runs. It is optional when your project has exactly one usable region. When the project has several and you send none, the request is refused with 422 region_required (the error lists the regions to choose from); an unknown region gives 422 region_unavailable.

Returns 201 Created. Provisioning is asynchronous — watch status and lastOperation on subsequent GET calls.

Register a generic cluster

POST /k8s/clusters?project_id=<uuid>
Authorization: Bearer <token>
Content-Type: application/json

{
  "kind": "generic",
  "name": "on-prem-k3s",
  "kubeconfig": "<base64-or-raw-yaml>"
}

The kubeconfig field is write-only — it is stored encrypted and never returned in responses. Use has_kubeconfig: true in the response to confirm it was saved.

Show a cluster

GET /k8s/clusters/{id}?project_id=<uuid>
Authorization: Bearer <token>

Key response fields:

Field Description
kind gardener or generic
id Cluster identifier
name Display name
status Gardener shoot status object (Gardener clusters only)
lastOperation Most recent Gardener operation (Gardener clusters only)
creating true while the cluster is still being provisioned
api_server Kubernetes API server URL (Gardener clusters only)
has_kubeconfig true if a kubeconfig is stored (generic clusters only)
connection_status reachable or unreachable — API server probe result (generic only)
cloud Cloud provider name
version Kubernetes version
node_pools Array of node pool objects

Update a cluster

PATCH /k8s/clusters/{id}?project_id=<uuid>
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "new-name"
}

For generic clusters you can also rotate the kubeconfig:

{ "kubeconfig": "<new-kubeconfig-yaml>" }

Delete a cluster

DELETE /k8s/clusters/{id}?project_id=<uuid>
Authorization: Bearer <token>

Returns 204 No Content. For Gardener clusters, deletion is asynchronous and involves deprovisioning the cloud resources; the cluster disappears from list results once Gardener confirms teardown.

Download kubeconfig

For Gardener-managed clusters connected to your project, you can download a ready-to-use kubeconfig directly from the platform:

GET /k8s/clusters/{id}/kubeconfig?project_id=<uuid>
Authorization: Bearer <token>

Returns 200 OK with a JSON body: data.kubeconfig is the kubeconfig as YAML, data.filename a suggested file name (for example my-shoot.kubeconfig). Write data.kubeconfig into a new file that only you can read, and point kubectl at it via KUBECONFIG:

(umask 077 && curl -s -H "Authorization: Bearer $TOKEN" \
  "https://api.bnerd.cloud/k8s/clusters/<id>/kubeconfig?project_id=<uuid>" \
  | jq -r '.data.kubeconfig' > my-shoot.kubeconfig)
export KUBECONFIG=$PWD/my-shoot.kubeconfig
kubectl get nodes

The kubeconfig is a credential

It grants cluster-admin access until it expires. Keep the file private (mode 0600, which umask 077 in the subshell gives it), do not write it over an existing kubeconfig, do not commit it and do not share it. Delete it when you no longer need it.

The CLI does not download kubeconfigs. Use the API call above or the dashboard: Kubernetes → Clusters → cluster detail → Download Kubeconfig.

The download is a short-lived (8-hour) cluster-admin kubeconfig. It needs the garden:update permission, because downloading admin credentials is a manage action. Without garden:update the response is 403. Every download is audited. If the download could not be recorded in the audit log, the kubeconfig is not delivered: the response is 503 kubeconfig_audit_unavailable. The error is retryable; retry the request.

For generic clusters the kubeconfig is write-only and cannot be downloaded via this endpoint — manage it at your cluster's own source.

Cloud profiles

Cloud profiles enumerate the Kubernetes versions, machine types, and regions available for Gardener-managed clusters:

GET /k8s/cloudprofiles
Authorization: Bearer <token>

Use this to discover valid values for version, machine.type and region when creating a Gardener cluster.

  • Node Pools — manage worker node pools within a cluster