# Operations

Day-to-day running of tenants: health, upgrades, backups, keys and removal. Every command runs inside your environment. The examples use the tenant from [Install a tenant](install.md): release `arena` in namespace `arena-tenant-a`, agent release `arena-agent` in namespace `arena-agent`.

## Check health

The self-check runs after every install and upgrade (`kubectl -n arena-tenant-a logs job/arena-doctor`). To run it at any time, feed it the allowlist the chart generated:

```bash
kubectl -n arena-tenant-a get configmap arena-doctor-allowlist \
  -o jsonpath='{.data.outbound-allowlist\.txt}' \
  | kubectl -n arena-tenant-a exec -i deploy/arena-api -- \
    sh -c 'cat > /tmp/allowlist.txt && /usr/app/arena-cli task doctor_outbound allowlist:/tmp/allowlist.txt'
```

The self-check covers Postgres, the object store, OpenObserve and the GPU cluster, and confirms that every configured endpoint is inside your environment. Add `list:true` to print every endpoint it checked. It exits non-zero if anything fails, so you can run it from your own monitoring.

Each component also has standard Kubernetes liveness and readiness probes. The API serves these paths on the `arena-api` Service, port 3001, inside the cluster. The ingress at the tenant’s domain doesn’t route them, so point in-cluster monitoring at `http://arena-api.arena-tenant-a.svc:3001`, or check by hand with `kubectl -n arena-tenant-a port-forward svc/arena-api 3001`:

| Path               | Returns                                                                                                     |
|--------------------|-------------------------------------------------------------------------------------------------------------|
| `/livez`           | `200` when the API process is up                                                                            |
| `/readyz`          | `200` when Postgres and the object store both answer; `503` when either doesn’t. Point your monitoring here |
| `/readyz/database` | `200` when Postgres answers. The API pod’s readiness probe uses this path                                   |

The readiness probe checks only Postgres. During an object store outage the API pod stays Ready, so your service still reaches it and gets an error that names the problem, such as `503 storage_unavailable`, while `/readyz` returns `503`. The API logs `/readyz dependency check failed` with the dependency that failed.

The GPU cluster’s state and the agent’s last contact time:

```bash
kubectl -n arena-tenant-a exec deploy/arena-api -- /usr/app/arena-cli task clusters_status
```

```text
tenant-a-gpus   Ready   8x nvidia-b300   agent 1.4.0   last contact 4s ago   jobs running 1, queued 2
```

The state is `Waiting` until the agent first connects, `Ready` while it keeps polling without errors, `Degraded` when it stops polling or reports an error, and `Disabled` for a disabled cluster. The GPU count is that of the largest resource class of each GPU type in `gpuCluster.classes`. `jobs running` counts jobs that are training and jobs that have GPUs and are starting (`Pending`); `queued` counts jobs waiting for GPUs.

## Logs

All components log to standard output, so your log tooling picks them up. Training and inference logs are also kept in the tenant’s OpenObserve, and your service can read them through the API next to metrics.

## Upgrade

### What you do

1. Read `RELEASE-NOTES.md` in the new bundle for the platform release, ML bundle and image versions it brings.
2. Mirror the new images (once per release):
   ```bash
   ./arena-self-hosted-1.5.0/mirror-images.sh arena-self-hosted-1.5.0 registry.internal/arena
   ```
3. Upgrade each tenant with its existing values file:
   ```bash
   helm upgrade arena arena-self-hosted-1.5.0/charts/arena-self-hosted-1.5.0.tgz \
     -n arena-tenant-a -f tenant-a.yaml --wait --timeout 20m
   ```
4. Copy the agent values again, then upgrade the agent with them:
   ```bash
   kubectl -n arena-tenant-a get secret arena-agent-values \
     -o jsonpath='{.data.values\.yaml}' | base64 -d > agent-values.yaml
   helm upgrade arena-agent arena-self-hosted-1.5.0/charts/arena-byoc-agent-1.5.0.tgz \
     -n arena-agent -f agent-values.yaml --set provisioner.enabled=false --wait
   ```

### What happens

Each upgrade runs a new migration Job; the new API and worker pods restart until the schema matches, while the old ones keep serving. History, API keys, models, checkpoints and deployments carry over. Bootstrap and the self-check run again at the end of the upgrade. The self-check reports a GPU cluster whose agent has stopped reporting as `warning`, so you can upgrade the control plane while the GPU cluster is down.

Bootstrap keeps the key and the cluster registration while `arena-partner-key` and `arena-agent-values` still hold them. It brings the resource classes and node selector in line with the values file, and writes the new release’s agent and validator images into `arena-agent-values`; its log shows `agent values   updated in secret arena-agent-values`. The cluster token doesn’t change, so the `cluster-token` Secret stays as it is. An agent upgraded with the previous release’s `agent-values.yaml` keeps running the previous release’s images, so always copy the values again first.

Each job and deployment runs in its own namespace on the GPU cluster, named `arena-ent-train-<key>-<job>` or `arena-inf-<key>-<deployment>`. The key is eight characters that differ for each GPU cluster registration, so two tenants’ agents in one Kubernetes cluster never pick the same name. The agent labels each namespace it creates with `arena.agilerl.com/agent-namespace: <agent namespace>`, and only removes a namespace that already has its own label. An unlabelled namespace is left in place. Jobs and deployments that were running before the release that added the key keep their old names (`arena-ent-train-<job>`, `arena-inf-<deployment>`). A deployment which was not installed yet (no phase, or still copying its checkpoint) is given the new name at upgrade. Upgrade both agents first. The upgraded agent adds its label to an unlabelled `arena-ent-train-<id>` or `arena-inf-<id>` when it next installs into it. Stop that job only after `kubectl get namespace <name> --show-labels` shows this agent’s `arena.agilerl.com/agent-namespace` label. Do not stop a shared id on the agent from before this release: that agent deletes `arena-ent-train-<id>` with no owner check. If two tenants share one unlabelled namespace, set the label to the agent namespace of the tenant that owns the workload before either upgraded agent stops the job. After the namespace is deleted, the next start of that deployment uses the keyed name.

To roll back, `helm rollback` to the previous revision. That brings back the previous charts and images but doesn’t undo database migrations. If the new release changed the schema, restore a backup taken before the upgrade instead.

## Back up

A tenant’s state is its Postgres database, its bucket, and the Secret `arena-secrets-key`. Back up all three together. A restore without that Secret can’t read organisation secrets. Save the Secrets `arena-partner-key` and `arena-agent-values` with them, so a restored tenant keeps its API key and GPU cluster registration.

```bash
DAY=$(date +%F)
kubectl -n arena-tenant-a exec statefulset/arena-postgres -- \
  sh -c 'pg_dump -U "$POSTGRES_USER" -Fc "$POSTGRES_DB"' > tenant-a-$DAY.dump
aws --endpoint-url https://s3.internal s3 sync s3://arena-tenant-a s3://backups/tenant-a/$DAY/
for s in arena-secrets-key arena-partner-key arena-agent-values; do
  kubectl -n arena-tenant-a get secret $s -o json \
    | jq 'del(.metadata.resourceVersion, .metadata.uid, .metadata.creationTimestamp, .metadata.managedFields, .metadata.ownerReferences)' \
    > tenant-a-$s.json
done
```

The `jq` step drops the fields the cluster sets, so the Secrets can be applied to a fresh namespace. The files hold the tenant’s encryption key, its API key and the agent’s credentials: store them like any other secret.

If you use an external Postgres, back it up with your usual tooling.

## Restore

Recreate the namespace and the Secrets your values file names (step 3 of [Install a tenant](install.md)), then install a fresh tenant with the same values file and `restore` on, which skips bootstrap. The install has already created the schema, so load the backup into an empty database: stop the Deployments and wait for their pods to exit, drop and create the database, restore, copy the bucket back, then start the Deployments again.

```bash
kubectl create namespace arena-tenant-a
kubectl -n arena-tenant-a create secret generic tenant-a-s3 \
  --from-literal=accessKeyId=… --from-literal=secretAccessKey=…
kubectl -n arena-tenant-a create secret tls arena-tenant-a-tls --cert=tls.crt --key=tls.key

helm install arena charts/arena-self-hosted-1.4.0.tgz -n arena-tenant-a -f tenant-a.yaml \
  --set arena-platform.restore=true --wait --timeout 20m
for s in arena-secrets-key arena-partner-key arena-agent-values; do
  kubectl -n arena-tenant-a apply -f tenant-a-$s.json
done
kubectl -n arena-tenant-a get deploy \
  -o jsonpath='{range .items[*]}{.metadata.name}={.spec.replicas}{"\n"}{end}' > tenant-a-replicas.txt
kubectl -n arena-tenant-a scale deploy --all --replicas=0
# Deployment pods carry pod-template-hash; the StatefulSets' pods, Postgres among them, don't.
until pods=$(kubectl -n arena-tenant-a get pods -l pod-template-hash -o name) && [ -z "$pods" ]; do
  sleep 5
done
kubectl -n arena-tenant-a exec statefulset/arena-postgres -- \
  sh -c 'dropdb -U "$POSTGRES_USER" --force "$POSTGRES_DB" && createdb -U "$POSTGRES_USER" "$POSTGRES_DB"'
kubectl -n arena-tenant-a exec -i statefulset/arena-postgres -- \
  sh -c 'pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB"' < tenant-a-2026-11-18.dump
aws --endpoint-url https://s3.internal s3 sync s3://backups/tenant-a/2026-11-18/ s3://arena-tenant-a
while IFS='=' read -r d n; do
  kubectl -n arena-tenant-a scale deploy "$d" --replicas="$n"
done < tenant-a-replicas.txt
```

Each step exits 0, so they can run in a script with `set -e`. Don’t restore with `pg_restore --clean` over the installed schema instead: it can’t drop the keys of the audit log’s monthly partitions and exits 1.

A fresh install creates its own `arena-secrets-key`. Applying the backup replaces it, and the Deployments load that key when they start again. API keys, experiments, models, checkpoints, deployments and organisation secrets come back as they were at backup time. OpenObserve’s volume isn’t part of this backup, so live logs and metrics from before it aren’t restored. If the agent was removed too, install it again as in step 7 of [Install a tenant](install.md).

Leave `restore` out of later upgrades. Bootstrap then runs again, finds the key and cluster from the backup, and keeps them.

## Rotate the API key

Turn on `bootstrap.rotateKey` for one upgrade, then turn it off again:

```bash
helm upgrade arena charts/arena-self-hosted-1.4.0.tgz -n arena-tenant-a -f tenant-a.yaml \
  --set arena-platform.bootstrap.rotateKey=true --wait --timeout 20m
kubectl -n arena-tenant-a get secret arena-partner-key -o jsonpath='{.data.key}' | base64 -d
helm upgrade arena charts/arena-self-hosted-1.4.0.tgz -n arena-tenant-a -f tenant-a.yaml \
  --wait --timeout 20m
```

The bootstrap Job writes a new key to the Secret `arena-partner-key`, and its log shows when the old keys stop working (`old api keys   1 valid until …`). The old key keeps working for 24 hours, so your service can switch without downtime. To end it at once, also set `arena-platform.bootstrap.revokeOld=true` on the first upgrade; `revokeOld` without `rotateKey` fails the upgrade. Don’t leave `rotateKey` on: every upgrade would mint another key.

## Change the private CA

Put the new CA’s PEM in `arena-platform.tls.caBundle` and run `helm upgrade`. Bootstrap writes it into the agent values in `arena-agent-values`. Copy the agent values again and upgrade the agent, as in step 7 of [Install a tenant](install.md); the agent restarts with the new CA. Training and inference pods started after the upgrade trust it. While the old and new certificates overlap, put both CAs in the bundle.

## Change a tenant’s GPUs

The tenant’s resources are the classes in `arena-platform.gpuCluster.classes`. To add one, for example `b300-8x2` after adding a second node, add it to the list and run `helm upgrade`. Bootstrap creates new classes and updates changed ones in place, matched by name. Taking a class out of the list doesn’t delete it.

To point a tenant at different nodes, change `arena-platform.gpuCluster.nodeSelector` and run `helm upgrade`. Bootstrap applies the new selector to every class and to the agent values in `arena-agent-values`. Copy the agent values again and upgrade the agent, as in step 7 of [Install a tenant](install.md), so the agent’s own pods move too.

## Remove a tenant

### What you do

```bash
helm uninstall arena-agent -n arena-agent --timeout 10m  # on the GPU cluster
kubectl delete namespace arena-agent           # on the GPU cluster
helm uninstall arena -n arena-tenant-a
kubectl delete namespace arena-tenant-a
aws --endpoint-url https://s3.internal s3 rm --recursive s3://arena-tenant-a
```

### What happens

Uninstalling the agent stops every job and deployment on the GPU cluster. Before it removes itself, a hook Job (`arena-byoc-agent-namespace-cleanup`) first scales the agent to 0 and waits until its pod is deleted, then deletes every namespace labelled `arena.agilerl.com/agent-namespace: arena-agent`, the agent’s own namespace. That removes each job’s and deployment’s Helm release, pods, Roles, RoleBindings and the store Secret copied into it. The Job can run for 400 seconds, past Helm’s default 5 minute wait, so the command passes `--timeout 10m` and `helm uninstall` waits for the namespaces to go. If the hook fails, the agent stays scaled to 0; run the same `helm uninstall --timeout 10m` again. A retry that uses the default timeout deletes the Job while the namespace delete is still running. A namespace with no label is one from before the label existed and is not deleted: if `kubectl get namespace -l '!arena.agilerl.com/agent-namespace' | grep -E 'arena-(ent-train|inf)-[0-9]+$'` lists any, check they belong to this tenant and delete them. Uninstalling the control plane removes every Kubernetes object it created. The generated Secrets (`arena-secrets-key`, `arena-postgres` and the OpenObserve credentials) outlive `helm uninstall` and go with the namespace, as do the bundled Postgres, Pulsar and OpenObserve volumes. Deleting the bucket contents removes datasets, models and checkpoints. Nothing of the tenant remains anywhere else, since nothing was ever sent outside your environment.

## Troubleshooting

API errors with a code have the body `{"ok": false, "error": "<code>", "message": "…"}`. Training submit streams its answer, so it reports `run_does_not_fit` and `gpu_cluster_unavailable` as `detail.error_code` on the final `failed` line instead of as an HTTP status. The [Partner API reference](../api-reference.md#errors) lists every error your developers can see.

| Symptom                                                     | Cause                                                                                                                                                                                                                                                                                                                                                             | Fix                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Pods stuck in `ImagePullBackOff`                            | Images not in your registry, or `arena-platform.image.registryOverride` points somewhere else                                                                                                                                                                                                                                                                     | Run `mirror-images.sh` for this release; check `arena-platform.image.registryOverride` and `openobserve.image.oss.repository`                                                                                                                                                                                                                                                                                                                                                             |
| Install fails on the `arena-doctor` Job                     | A dependency is down, or a value points outside your environment                                                                                                                                                                                                                                                                                                  | `kubectl -n arena-tenant-a logs job/arena-doctor` names the dependency, or the key and host. Fix the values file, or add an external OpenObserve host to `arena-platform.doctor.allowlist`                                                                                                                                                                                                                                                                                                |
| `gpu cluster waiting` after the agent install               | Agent can’t reach the API’s DNS name, doesn’t trust its certificate, or has no `cluster-token` Secret                                                                                                                                                                                                                                                             | From a GPU node, call the partner API’s resources endpoint at `https://arena.tenant-a.internal` over HTTPS without a key, trusting your CA: a `401` reply means the name resolves, the certificate is trusted and the API answers. `/livez` isn’t routed through the ingress, so it returns `404` there. For a private CA, check that `caBundle.pem` in the agent values matches `arena-platform.tls.caBundle`, then upgrade the agent. Check the `cluster-token` Secret in `arena-agent` |
| No resources listed                                         | `gpuCluster.classes` is empty, or bootstrap failed before creating the classes                                                                                                                                                                                                                                                                                    | `kubectl -n arena-tenant-a logs job/arena-bootstrap` should end with one `resource class` line per class                                                                                                                                                                                                                                                                                                                                                                                  |
| Training or inference pods stay `Pending`                   | No nodes match `gpuCluster.nodeSelector`, or the GPU Operator isn’t running                                                                                                                                                                                                                                                                                       | `kubectl get nodes -l <selector>`; check `nvidia.com/gpu` capacity on the nodes                                                                                                                                                                                                                                                                                                                                                                                                           |
| Jobs stay `Queued`                                          | GPUs are taken by running jobs or deployments                                                                                                                                                                                                                                                                                                                     | `/usr/app/arena-cli task clusters_status`; take deployments you don’t need offline                                                                                                                                                                                                                                                                                                                                                                                                        |
| Pods can’t read the bucket                                  | The store Secret in `arena-agent` is missing or has the wrong keys                                                                                                                                                                                                                                                                                                | It needs the same name as `arena-platform.storage.existingSecret` and the keys from step 3 of [Install a tenant](install.md)                                                                                                                                                                                                                                                                                                                             |
| `503 storage_unavailable`                                   | Object store unreachable or key wrong                                                                                                                                                                                                                                                                                                                             | Check the endpoint and the key in the `arena-platform.storage.existingSecret` Secret                                                                                                                                                                                                                                                                                                                                                                                                      |
| `/readyz` returns `503` while the API pod is Ready          | The object store doesn’t answer                                                                                                                                                                                                                                                                                                                                   | The API log line `/readyz dependency check failed` names the dependency                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Dataset upload fails                                        | `409 gpu_cluster_unavailable`: the agent is down. Otherwise the stored file is over 64 MiB                                                                                                                                                                                                                                                                        | Upload again once `clusters_status` shows the cluster `Ready`. Keep the file at or under 64 MiB                                                                                                                                                                                                                                                                                                                                                                                           |
| Environment create fails, or an environment never validates | `409 gpu_cluster_unavailable`: the agent is down. An environment created while the GPU cluster was offline, before the release that pins environments to the cluster’s store, has no cluster: its files are in the tenant bucket outside the cluster’s `clusters/<name>/` prefix, and its validation goes to a control-plane validator that a tenant does not run | Wait until `clusters_status` shows the cluster `Ready`. For an environment made while the cluster was offline before that release, delete it first, then create it again: creating the same name without deleting it reuses the old environment                                                                                                                                                                                                                                           |
| `409 gpu_cluster_unavailable`                               | The GPU cluster is disabled, never connected, or its agent has been silent for more than 3 minutes. The body has `cluster` on a dataset upload or an environment create                                                                                                                                                                                           | `clusters_status`; check the agent’s pods in `arena-agent`                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `400 run_does_not_fit`                                      | The run can never fit the resource it names, or any resource when it names none. The body has `required` (`gpus`, `num_nodes`, `gpu_memory_gb`) and `available` (`resource`, `gpus`, `num_nodes`, `gpu_memory_gb`)                                                                                                                                                | Change the run, or add a larger class to `gpuCluster.classes`                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `400 huggingface_offline`                                   | The request needed the Hugging Face Hub: dataset search, or a dataset from Hugging Face                                                                                                                                                                                                                                                                           | Upload the dataset file. Add base models as in [Base models](models.md)                                                                                                                                                                                                                                                                                                                                                                                 |
| `401`                                                       | Key wrong, revoked, or from another tenant                                                                                                                                                                                                                                                                                                                        | Read the current key from the Secret `arena-partner-key`                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `404`                                                       | Not found in this tenant                                                                                                                                                                                                                                                                                                                                          | Check the name                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `429`                                                       | Rate limited                                                                                                                                                                                                                                                                                                                                                      | Wait `Retry-After` seconds                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
