# kubernetesSubstrates (/docs/reference/api/kubernetes-substrates)

> A pool substrate is the managed Kubernetes cluster behind a pool whose policy has a `substrate` (`kind: 'kubernetes'`, an `account`, and `cluster: { create }` or `cluster: { adopt }`). The `kubernetes.substrates` reconciler records it here: it creates the cluster with one node pool per flavor (or adopts an existing cluster and adds the flavors' node pools to it, named `bc-<pool>-<flavor>` so they never collide with the tenant's own pools), server-side applies bcd's DaemonSet with a hosted join token, and the cluster's Nodes join the pool. Every object it applies carries the label `better-compute.dev/substrate-pool=<pool id>`; on an adopted cluster an object of the same name it did not create is never taken over or deleted. There is nothing to call to create or delete a substrate: change the pool's policy, or archive the pool to tear it down.



A pool substrate is the managed Kubernetes cluster behind a pool whose policy has a `substrate` (`kind: 'kubernetes'`, an `account`, and `cluster: { create }` or `cluster: { adopt }`). The `kubernetes.substrates` reconciler records it here: it creates the cluster with one node pool per flavor (or adopts an existing cluster and adds the flavors' node pools to it, named `bc-<pool>-<flavor>` so they never collide with the tenant's own pools), server-side applies bcd's DaemonSet with a hosted join token, and the cluster's Nodes join the pool. Every object it applies carries the label `better-compute.dev/substrate-pool=<pool id>`; on an adopted cluster an object of the same name it did not create is never taken over or deleted. There is nothing to call to create or delete a substrate: change the pool's policy, or archive the pool to tear it down.

All 1 methods are served by @better-compute/server 0.3.0.

| Method        | Kind | Authorization                                | Phase | Status     |
| ------------- | ---- | -------------------------------------------- | ----- | ---------- |
| [`get`](#get) | read | `compute:kubernetes:read` @ `compute-tenant` | v1.0  | registered |

## get [#get]

`POST /api/compute/kubernetesSubstrates/get`

Returns the pool's substrate: `poolId`, `tenantId`, `providerAccountId`, `mode` (`create` or `adopt`), the `clusterId` of its [kubernetesClusters](/docs/reference/api/kubernetes-clusters) row once recorded, `state` (`pending`, `provisioning`, `ready`, `updating`, `error`, `deleting`, `deleted`) with a `message` when there is something to fix or wait for, `nodesListed` and `nodesJoined` (the substrate's Nodes the cluster last listed, and of them the ones whose bcd joined the pool), `waitingToJoin` (`{ nodes, since }`: how many listed Nodes have no joined bcd, and since when none has joined; after 15 minutes the `message` says what to check, while the state stays `ready`), and `upgrade` (`{ version, since }`) while an `upgrades: 'drain'` upgrade waits for bookings to end. It never returns the join token, its id or a credential. A pool without a substrate is `NOT_FOUND`. Decided as `compute:kubernetes:read` on the pool owner's tenant.

* **Kind:** read
* **Authorization:** `compute:kubernetes:read` @ `compute-tenant`
* **Module:** `kubernetes`
* **Phase:** v1.0 (registered)

**Input**

| Field      | Type   | Required | Constraints                                                       |
| ---------- | ------ | -------- | ----------------------------------------------------------------- |
| `tenantId` | string | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `poolId`   | string | yes      | at most 57 characters; matches `^pool_[0-9a-hjkmnp-tv-z]{26,52}$` |
