---
title: "Several cells"
description: "Run one control plane per cluster and a fleet control plane over them for one view and a licence key summed across cells."
url: "https://opod.io/docs/control-plane/fleet/"
markdown_url: "https://opod.io/docs/control-plane/fleet.md"
section: "Control plane"
last_updated: "2026-10-31"
---

# Several cells

> Run one control plane per cluster and a fleet control plane over them for one view and a licence key summed across cells.

## In short

A **cell** is one cluster and its control plane. When you run several, a **fleet** control plane shows them all on one **Clusters** page and adds up each licence key's GPUs across the cells that carry it. The fleet manages no cluster and creates nothing: it only reads each cell with a read-only token and tells each cell whether its key is over. Fleet mode is new in `0.3.0`.

## When you need it

- You run opod in more than one cluster (regions, sites, a lab and production) and want one view.
- One licence key covers several cells, and the sum must be enforced.
- You want one place to see which cell has open alerts or unhealthy endpoints.

## Do it

1. **Mint a machine token on each cell**

   Run this against each cell's control plane, with that cell's admin token:

   ```bash
   opodcp token create --cp https://opod.lab.example.com --token <admin token> --scope fleet fleet-view
   ```

   The flags go before the name. The command prints `token tok_… (fleet-view, scope fleet) — printed once, on stdout:` on stderr and the token itself on stdout, once. A `fleet` token reads like a viewer and has one write: the fleet licence fact.

2. **Store each token in the fleet's namespace**

   ```bash
   kubectl create namespace opodcp-fleet
   kubectl -n opodcp-fleet create secret generic lab-fleet-token --from-literal=token=<the token>
   ```

3. **Install the release in fleet mode**

   ```bash
   helm install opodcp-fleet oci://ghcr.io/opod-io/charts/opodcp -n opodcp-fleet \
     --set mode=fleet \
     --set substrate.leaderWorkerSet.enabled=false \
     --set ports.state.dsnSecret.name=opodcp-fleet-state \
     --set-json 'fleet.cells=[{"name":"lab","url":"https://opod.lab.example.com","tokenSecret":{"name":"lab-fleet-token","key":"token"}}]'
   ```

   A fleet keeps its own users, sessions and audit in a database of its own: create Secret `opodcp-fleet-state` with key `dsn` the same way as for a cell. With no `tokenSecret`, the chart reads Secret `<fullname>-fleet-<name>` (for example `opodcp-fleet-fleet-lab`), key `token`. Tokens are mounted as files and re-read on every pass.

## Check it worked

```bash
export H="Authorization: Bearer $(kubectl -n opodcp-fleet get secret opodcp-fleet-admin -o jsonpath='{.data.token}' | base64 -d)"
kubectl -n opodcp-fleet port-forward svc/opodcp-fleet 8080:8080 &
curl -s -H "$H" http://127.0.0.1:8080/api/v1/version | jq -r .mode
curl -s -H "$H" http://127.0.0.1:8080/api/v1/fleet/overview | jq '{totals, cells: [.cells[] | {name, reachable, gpus, error}]}'
```

A good answer prints `fleet`, then one entry per cell with `"reachable": true` and its GPU count. On each cell, `GET /api/v1/licence` carries the `fleet` fact within 30 s. The fleet console's **Clusters** page lists the cells, each linked to its own console.

## If it fails

| Answer                                                                                                            | Cause                                                        | Fix                                                                                                                                   |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| `mode=fleet installs no cluster substrate: set substrate.leaderWorkerSet.enabled=false`                           | the default LeaderWorkerSet subchart is on                   | add `--set substrate.leaderWorkerSet.enabled=false` (likewise for `substrate.keda.enabled`, `ha.postgres.provide`, `ha.nats.provide`) |
| `mode=fleet runs one replica: set replicas=1`                                                                     | `replicas` above 1                                           | set `replicas=1`                                                                                                                      |
| `error: usage: opodcp token create [--scope viewer\|fleet\|tokens:write\|plans:write] [--expires-in 720h] <name>` | a flag after the name                                        | put every flag before the name                                                                                                        |
| A cell reads `"reachable": false` with `error`                                                                    | the fleet cannot reach the cell's URL, or the token is wrong | check the URL from the fleet's pod, and the Secret and key named in `tokenSecret`                                                     |
| A cell has `tellError`                                                                                            | the cell refused the licence fact                            | the token's scope must be `fleet`, not `viewer`                                                                                       |
| `409 not_fleet` on `/api/v1/fleet/overview`                                                                       | you asked a cell, not the fleet                              | ask the fleet's own URL                                                                                                               |

## How a fleet works

A **cell** is one cluster and its control plane. To see several cells in one place, install a second release in **fleet mode**. A fleet control plane manages no cluster: it reads each cell's API with a machine token, shows the cells on its **Clusters** page, and sums each licence key across the cells that carry it.

> **Version and proof**
>
> Fleet mode is new in `0.3.0`. It is proven in tests against two control planes; a join of two production cells has not been shown yet.

## What a fleet does

Every 30 s the fleet runs one pass over its cells, each with a 10 s HTTP timeout:

1. **Read.** For each cell it reads `/api/v1/version`, `/api/v1/licence`, `/api/v1/nodes`, `/api/v1/endpoints` and `/api/v1/alerts?state=open`, with that cell's token. A token file is read again on every pass, so a rotated token needs no restart.
2. **Sum.** It adds the cells up. An unreachable cell keeps its last counts in the totals: the GPUs it had are still GPUs you run.
3. **Group by key.** It groups the cells by licence key (cells with no key form the group `free`), adds up their GPUs, and marks a group `over` when the sum is above the key's GPU count.
4. **Tell.** It sends each reachable cell its group's fact with `PUT /api/v1/licence/fleet`: `over`, `fleetGpus`, `keyGpus`, `cells` (how many the sum covers), `fleet` (its own name) and `at`. A cell that does not answer keeps the last fact it was given. See [Licensing](https://opod.io/docs/control-plane/licensing/).

It creates, places and proxies nothing. To create an endpoint, open the cell's own console; each row on the Clusters page links there.

## The overview

`GET /api/v1/fleet/overview` (viewer) answers:

```json
{
  "fleet": "hq",
  "at": "2026-10-30T12:00:00Z",
  "cells": [
    {
      "name": "lab", "url": "https://opod.lab.example.com", "reachable": true,
      "readAt": "2026-10-30T12:00:00Z", "version": "…",
      "nodes": 4, "nodesReady": 4, "gpus": 8, "endpoints": 3, "endpointsHealthy": 3, "alertsOpen": 0,
      "licence": { "plan": "team", "maxGpus": 16, "source": "key", "state": "active", "tokenId": "…" },
      "told": { "over": false, "fleetGpus": 8, "keyGpus": 16, "cells": 1, "fleet": "hq" }
    }
  ],
  "totals": { "cells": 1, "reachable": 1, "nodes": 4, "nodesReady": 4, "gpus": 8, "endpoints": 3, "alertsOpen": 0 },
  "licences": [ { "key": "…", "plan": "team", "keyGpus": 16, "gpus": 8, "over": false, "cells": ["lab"] } ],
  "freeTierGpus": 4
}
```

- A cell that did not answer has `reachable: false` and `error`.
- `endpointsHealthy` counts endpoints that serve, or sleep by design (an autoscale floor of 0).
- `told` is what the cell reports it was last told; `tellError` is the last push that failed, and why.
- A licence group lists in `unknown` the cells whose licence could not be read. Their GPUs are not in the group's sum.

## What a fleet release renders

Only its own control plane: the Deployment, its Service, its admin Secret and a ServiceAccount with no role and no mounted token. No device plugin, PriorityClass, cluster role, preflight hook, cell door, KV store or network map. So a fleet fits in another namespace of a cell's own cluster.

The chart refuses a fleet release that:

- leaves `substrate.leaderWorkerSet.enabled` on (the subchart is chosen before any template runs, so turn it off by name),
- turns on `substrate.keda.enabled`, `ha.postgres.provide` or `ha.nats.provide`,
- sets `replicas` above 1. A fleet has no leader election, so every replica would poll every cell and push licence facts on its own.

## Run it without the chart

```bash
OPODCP_FLEET_CELLS='[{"name":"lab","url":"https://lab.example","tokenFile":"lab.token"}]' opodcp serve --mode fleet
```

`GET /api/v1/version` carries `mode: cell` or `mode: fleet`. A cell answers `409 not_fleet` on `/api/v1/fleet/overview`.
