# Install a BYOC cluster

Connect a Kubernetes cluster to Arena and install the agent into it, so your organization can train on it. On a cluster you already run, one command does it: `arena cluster connect` checks the cluster, registers it, installs the agent, waits for the agent to report its health and offers resource classes for the GPUs it found. Training runs on Arena’s cloud unless you do this; see [How BYOC works](byoc.md) for what changes.

## Prerequisites

Everyone needs:

- An **Enterprise** organization and the org **Admin** role.
- The Arena CLI, recent enough to have `arena cluster connect`, signed in (`uv tool install --upgrade agilerl`, then `arena login`, or set `ARENA_API_KEY`). See [Install and sign in](../cli/install.md). The web app path can skip it if you install with Helm.
- `kubectl` and Helm 3 on the machine that runs the install.
- A kubeconfig context for the cluster with cluster-admin rights. The install creates ClusterRoles and admission policies, so it needs those rights once. Later, only agent upgrades that change the agent’s permissions need them again.

The cluster needs:

- Kubernetes 1.30 or later.
- GPU nodes that advertise `nvidia.com/gpu`, from the NVIDIA GPU Operator or device plugin. Resource classes pick GPU nodes by the `nvidia.com/gpu.product` label, which NVIDIA GPU Feature Discovery (part of the GPU Operator) sets.
- One default StorageClass, or a StorageClass you name for Ray data.
- A namespace for the agent (`arena` by default) that allows privileged pods. The agent’s tunnel container and storage sidecar run privileged.
- No other Arena agent. Arena runs one agent per Kubernetes cluster.
- Outbound HTTPS to Arena, and outbound UDP to the Arena tunnel gateway. The gateway host is `wireguard.gatewayHost` in the agent Helm values Arena generates. The cluster needs no inbound access.
- Outbound HTTPS from the nodes to Arena’s private image registry, `761296822462.dkr.ecr.us-east-1.amazonaws.com`, and to the S3 endpoint it serves image layers from, `prod-us-east-1-starport-layer-bucket.s3.us-east-1.amazonaws.com`. Arena’s images are not public; see [Image pulls](#image-pulls).

What else depends on the **Cloud provider** you pick:

| Cloud provider        | You bring                                                                                                          | You also need                                                                          |
|-----------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| **Custom**            | A Kubernetes cluster you already run (self-managed, EKS, GKE or similar), and an S3-compatible bucket it can reach | A Secret with the bucket’s credentials (Step 1)                                        |
| **Nebius** or **AWS** | A cloud account. The Arena CLI creates the cluster and its bucket.                                                 | `terraform`, and the cloud’s own CLI (`nebius` or `aws`) signed in on the same machine |

Arena never creates a cluster from the browser. For **Nebius** and **AWS**, registering in the web app gives you the command to run.

Arena doesn’t provision clusters on Google Cloud. To use GKE or any other Kubernetes, create the cluster yourself and register it as **Custom**.

## Step 1: Create the storage Secret (Custom only)

The agent reads your bucket’s credentials from a Secret in its namespace, `arena`. Put the keys in a file, `arena-storage.env`:

```text
AWS_ACCESS_KEY_ID=<key>
AWS_SECRET_ACCESS_KEY=<secret>
```

Then create the namespace and the Secret. Both commands are safe to re-run:

```bash
kubectl --context '<kube-context>' create namespace arena --dry-run=client -o yaml \
  | kubectl --context '<kube-context>' apply -f -
kubectl --context '<kube-context>' create secret generic arena-storage -n arena \
  --from-env-file=arena-storage.env \
  --dry-run=client -o yaml | kubectl --context '<kube-context>' apply -f -
```

No bucket yet and just trying BYOC out? The CLI can install a bundled MinIO into the cluster instead; add `--install-storage` to `arena cluster register` in Step 3.

## Step 2: Run preflight (optional)

Preflight tells you what would stop the install before anything changes. It only reads the cluster, and it changes nothing in Arena.

```bash
arena cluster preflight --context '<kube-context>'
```

It prints one row per check, each with `PASS`, `WARN` or `FAIL`, and a fix for anything that is not a pass:

| Check                                                | What it looks at                                                                                                                                              |
|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `kubernetes_version`                                 | Kubernetes 1.30 or later                                                                                                                                      |
| `can_create_*`                                       | You may create namespaces, ClusterRoles, ClusterRoleBindings, and validating admission policies and bindings. A `no` here fails                               |
| `can_escalate_clusterroles`, `can_bind_clusterroles` | Warns without these. cluster-admin has both                                                                                                                   |
| `node_inventory`                                     | GPU nodes by product and GPU count. Warns when no node has GPUs, or when a GPU node has no `nvidia.com/gpu.product` label                                     |
| `storage_class`                                      | One default StorageClass, or that the class you passed with `--ray-data-storage-class-name` exists                                                            |
| `privileged_pods`                                    | A dry run of a privileged pod in the agent namespace (or `default` if that namespace does not exist yet). Kubernetes admits or refuses it without creating it |
| `one_agent`                                          | No other Arena agent is installed in the cluster                                                                                                              |

The command exits non-zero when any check fails. Warnings do not stop it. `--name` names an Arena cluster you already registered, so its own agent does not count as a second one. `--agent-namespace` checks a namespace other than `arena`. `--json` prints the whole report as one JSON document: the context, the API server, the cluster’s ID, whether it passed, and every check, each with its name, status, detail and fix.

`arena cluster connect` runs the same checks first. Run preflight on its own when someone else will do the install: without cluster-admin the permission rows fail, but the other rows still show what the cluster is missing.

## Step 3: Register the cluster and install the agent

Cluster names are unique in your organization. Registering a name that already exists updates that cluster.

### Web app

1. Open the profile menu, click **Settings**, then the **Bring your own compute** tab.
2. Click **Register cluster**.
3. Enter a **Name** and pick a **Cloud provider**: **Custom**, **Nebius** or **AWS**. You can’t change the provider later.
4. Fill in the provider’s fields:
   - **Custom**: under **Checkpoint storage**, the **Storage endpoint** (the S3 API the agent can reach, such as `https://s3.corp.example.com`), **Bucket**, and **Secret name** from Step 1. **Prefix** is optional.
   - **Nebius**: **Tenant ID** and **Region**, and optionally **Project ID** and **Subnet ID**. An empty **Project ID** creates a compute project, and an empty **Subnet ID** creates a VPC and subnet. A **Subnet ID** needs a **Project ID**. **Storage project ID** under **Networking and advanced** names an existing project for object storage and Terraform state; leave it empty to create one. The bucket is named after the cluster.
   - **AWS**: **Region**, **Kubernetes version** and **Arena instance type** (the CPU nodes the agent runs on). The form has no GPU workers: add them under `workers` in the spec file before you provision, or the cluster has no GPU nodes. The bucket is named after the cluster.
5. Leave **Networking and advanced** alone unless you need the settings described [below](#networking-and-advanced-settings).
6. Click **Register and continue**. The install dialog opens.
7. Install:
   - **Custom**: copy the `arena cluster register … --install` command under **Install the agent** and run it where `kubectl` points at your cluster. Without the Arena CLI, open **Install with Helm instead**: download the **Install package (.tar.gz)**, which has the charts, values, GitOps manifests and an `INSTALL.md` to follow on a bastion, or copy the **Helm install command** and `agent-helm-values.yaml`. The Helm command from the install package is safe to re-run. A new agent token is shown only once, so click **Copy agent token** before you close the dialog.
   - **Nebius** or **AWS**: under **Provision the cluster**, download the spec file and run the command shown. It creates the cluster, registers it and installs the agent. If the CLI rejects the file with `values and registration are not accepted`, write the spec with `arena cluster generate-spec` instead and keep the cluster name; see the CLI tab.
8. The steps at the top of the dialog (**Register**, **Install agent**, **Agent connects**, **Health checks**) and the status at the bottom fill in as the agent reports, so you can leave the dialog open while you run the command. Click **Done**.

The cluster shows **Pending install** until the agent first checks in, then **Connected**. To open the install dialog again later, select the cluster and click **Install agent**, which reads **Reinstall** once the agent has checked in.

### CLI

**Custom.** One command checks, registers and installs:

```bash
arena cluster connect --name corp-k8s --context '<kube-context>' \
  --storage-endpoint https://s3.corp.example.com \
  --storage-bucket arena-data \
  --storage-secret-name arena-storage
```

`connect`:

1. Runs preflight and stops on a failed check. Nothing has changed in Arena or the cluster at that point.
2. Registers the cluster in Arena, and turns on BYOC for your organization if it is not on yet.
3. Records which Kubernetes cluster it installed into. Every later command for this cluster checks that it is pointed at the same one.
4. Installs the agent with Helm as release `arena-byoc-agent` in namespace `arena`.
5. Waits for the agent’s first heartbeat, then for its first health report, and prints the health checks.
6. Lists the resource classes Arena suggests from the GPU nodes the agent found, and asks whether to create them. See [Step 5](#step-5-add-resource-classes).

It ends with `Cluster 'corp-k8s' is connected`. If the health report has a failing check, the command says so and exits non-zero. The cluster is still connected: fix the check and the agent reports again within 10 minutes. `--wait-timeout` sets how long it waits for the heartbeat and the health report (default 900 seconds), `--ray-data-storage-class-name` names a StorageClass for Ray data, and `--yes` creates the suggested classes without asking.

Running `connect` again with the same name updates the cluster, upgrades the agent in place and keeps its token. Use that to change storage settings or to repair an install. `--rotate-token` issues a new agent token for a cluster that is already registered.

`arena cluster register --install` also registers and installs, without the preflight and the wait. It takes the same flags as `connect`, plus the flags for the [networking and advanced settings](#networking-and-advanced-settings) and `--install-storage`. It writes the Helm values and agent token to `./arena-cluster-corp-k8s`; add `--no-write` to keep them off disk. Without `--install`, it only registers and writes those files. After the install it offers the suggested classes if the agent has already reported its nodes; right after a first install it usually hasn’t, and the CLI says so. If the agent namespace has no token Secret yet, for example because you registered the cluster in the web app and haven’t installed it, `--install` stops and asks for `--rotate-token`. The install command the web app shows after it issues a token already has `--rotate-token`.

**Nebius.** Start from a spec file, fill in your cloud IDs, check the plan, then provision:

```bash
arena cluster generate-spec --provider nebius --name lab-cluster
arena cluster plan --spec lab-cluster.yaml --create-state-bucket
arena cluster provision nebius --spec lab-cluster.yaml \
  --create-state-bucket --register-and-install
```

The spec needs a dedicated bucket for Terraform state, separate from the experiment-data bucket. `--create-state-bucket` creates it if it’s missing; without the flag, `plan` and `provision` ask before creating it. `--register-and-install` registers the cluster with Arena and installs the agent once the cluster is up. If you already registered the cluster in the web app, the spec file you downloaded there has the same name; run `provision` without `--register-and-install`, then install the agent with the command from **Install agent** on the cluster.

**AWS.** See [Provision on AWS](#provision-on-aws) below.

`arena cluster status --spec lab-cluster.yaml` prints the cluster’s endpoints and node groups afterwards.

Every flag is listed in the [command reference](../cli/commands/cluster.md). The `arena cluster` commands, and their `--help`, only appear once you’re signed in to an **Enterprise** organization.

### GitOps install (Argo CD or Flux)

If you manage the cluster with Argo CD or Flux, let it install and upgrade the agent from Arena’s chart registry instead of running Helm yourself. The install package has a `gitops/` folder:

| File                             | What                                                                                                                                                                                 |
|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `gitops/argocd-application.yaml` | An Argo CD `Application` in namespace `argocd`                                                                                                                                       |
| `gitops/flux.yaml`               | A Flux `HelmRepository` and `HelmRelease` in namespace `arena` (Flux 2.7.5 or later, the first release that accepts this HelmRelease and limits the status a failed upgrade records) |

Both install the chart `arena-byoc-agent` at the version this Arena release ships, as release `arena-byoc-agent` in namespace `arena`, with the same values as the Helm install plus `upgrade.mode: gitops`. The values name each Secret the agent reads and hold no token, key or password, so the files can go in git.

1. **Create the Secrets once.** `INSTALL.md` in the package has a bootstrap command. It creates namespace `arena`, the Secrets from the package’s `secrets/` folder (the agent token, the 12-hour registry login, and the WireGuard keys on a tunnel cluster), and the provisioner’s SSH key and token, which it generates only when they do not exist yet. Run it before the manifest, and again only with a new install package. Keep the Secrets out of git and out of your GitOps tool: after its first poll the agent replaces the token with its own credential (`arena-byoc-agent-credential`) and renews its registry login (`arena-byoc-agent-image-pull`) itself.
2. **Apply the manifest.** Commit one of the files to the repository your Argo CD or Flux syncs, or `kubectl apply -f` it. Flux pulls the chart with the agent’s registry login. Argo CD needs a repository Secret for `<registry>/charts` (the `repoURL` in the Application), with user name `AWS` and the password from the agent’s login. The login lasts 12 hours and the agent renews it every few hours, so copy it again on a schedule:
   ```bash
   kubectl -n arena get secret arena-byoc-agent-image-pull -o jsonpath='{.data.\.dockerconfigjson}' \
     | base64 -d | jq -rj '.auths[].password' > password
   kubectl -n argocd create secret generic arena-charts \
     --from-literal=type=helm --from-literal=name=arena-charts --from-literal=enableOCI=true \
     --from-literal=url=<registry>/charts --from-literal=username=AWS --from-file=password \
     --dry-run=client -o yaml \
     | kubectl label --local -f - argocd.argoproj.io/secret-type=repository -o yaml \
     | kubectl apply -f -
   rm password
   ```
3. **Check health** as in [Step 4](#step-4-check-health).

To upgrade, change the chart version in the manifest (`targetRevision` for Argo CD, `chart.spec.version` for Flux) to the one a newer install package shows, or write the new manifest with `arena cluster manifest --name <cluster> --format argocd|flux`. Arena does not upgrade a GitOps install itself and offers no upgrade button for it. Before each upgrade the chart’s drain hook holds new runs and waits until nothing is running on the cluster, for up to 30 minutes; a sync that times out is retried up to an hour later, until it succeeds. In Argo CD, a sync that is still retrying keeps the chart version and values it started with: change them, then terminate it (`argocd app terminate-op arena-byoc-agent`). Flux reads the HelmRelease again on each retry, and a new chart version upgrades straight away. If the new version changes the agent’s ClusterRoles, your GitOps tool needs the rights to apply them.

If you re-register the cluster with a new token, run the new package’s bootstrap command, then restart the agent with `kubectl -n arena delete pod -l app.kubernetes.io/name=arena-byoc-agent`.

To move an agent installed with Helm to GitOps, keep the provisioner’s SSH key: running job VMs accept only that key. Don’t `helm uninstall`, which deletes it.

1. Run the bootstrap command. It keeps the existing provisioner Secrets.
2. Detach those Secrets from the Helm release, so that neither Helm nor your GitOps tool deletes them:
   ```bash
   kubectl -n arena label secret arena-byoc-provisioner-ssh arena-byoc-provisioner-token \
     app.kubernetes.io/instance- app.kubernetes.io/managed-by- helm.sh/chart-
   kubectl -n arena annotate secret arena-byoc-provisioner-ssh arena-byoc-provisioner-token \
     meta.helm.sh/release-name- meta.helm.sh/release-namespace-
   ```
3. Delete Helm’s release records: `kubectl -n arena delete secret -l owner=helm,name=arena-byoc-agent`.
4. Apply the manifest. Argo CD or Flux adopts the agent’s other objects.

### Image pulls

Arena’s images (the agent, the validators, training and inference) are in a private registry. The agent Helm values Arena generates carry a registry login that lasts 12 hours (`imagePull.credential`), and the chart keeps it in the Secret `arena-byoc-agent-image-pull`. Keep the values file private, like the token. After that the agent renews the login itself every few hours, signing in to Arena with its own token, and copies it into each job and deployment namespace as the Secret `arena-image-pull`. Nothing else is needed.

If the agent cannot renew the login, the **Image pull credential** health check turns red and says why. Pods that are already running keep running. A cluster that was offline for more than 12 hours may not be able to start the agent’s pods on a new node; run `arena cluster upgrade` to install a fresh login.

When a GitOps tool installs the agent, the values in git hold no login: the bootstrap command creates `arena-byoc-agent-image-pull` from the install package, and the agent renews it from then on. If your own tooling keeps a login Secret fresh, set `imagePull.mode: external` and `imagePull.secretName` to that Secret, and the agent only copies it.

## Step 4: Check health

The agent sends a health report when it starts and every 10 minutes. On the **Bring your own compute** tab, select the cluster and look at **Health**. Each check shows **OK**, **Warning** or **Failing**, with the fix underneath:

| Check                     | OK when                                                                                                                 |
|---------------------------|-------------------------------------------------------------------------------------------------------------------------|
| **Health report**         | The last report is 25 minutes old or less                                                                               |
| **Kubernetes version**    | 1.30 or later                                                                                                           |
| **Nodes**                 | At least one node advertises `nvidia.com/gpu`. The table under the checks lists GPU model, GPUs per node and node count |
| **StorageClass**          | One default StorageClass, or the cluster’s Ray data StorageClass exists                                                 |
| **Tunnel**                | The tunnel’s last handshake was within 5 minutes of the report                                                          |
| **Storage**               | The agent reached your bucket                                                                                           |
| **Credential**            | The cluster has an active agent token                                                                                   |
| **Image pull credential** | The agent renewed its registry login and it has not expired                                                             |
| **Agent permissions**     | The agent’s ClusterRoles match this Arena release                                                                       |
| **One agent**             | No other Arena agent runs in the cluster                                                                                |

**Classes with no matching nodes** lists any resource class whose node placement labels match no node the agent reported. Jobs on those classes stay pending.

The status next to the cluster name, with **Last poll** under it:

| Status              | Meaning                                                                                                            |
|---------------------|--------------------------------------------------------------------------------------------------------------------|
| **Pending install** | Registered, but the agent has not checked in yet                                                                   |
| **Connected**       | The agent checks in every minute                                                                                   |
| **Degraded**        | The agent has not checked in for 3 minutes, or its last check-in reported an error. The error shows below the name |
| **Disabled**        | Credentials are revoked and the cluster takes no runs. **Restore** brings it back                                  |
| **Removing**        | The agent is deleting its job namespaces before Arena archives the cluster                                         |

The cluster’s details also show its **Provider**, **Agent token** (whether it has an active one), **Token last used**, **Enabled capacity** (nodes and GPUs across enabled classes), and the **Storage bucket**, **Storage prefix** and **Storage endpoint** the agent stores checkpoints and datasets in. Notices above the details, such as **Needs your approval** or **Credential renewal pending**, are covered under [Approve and apply agent upgrades](#approve-and-apply-agent-upgrades) and [Rotate or revoke the agent credential](#rotate-or-revoke-the-agent-credential).

## Step 5: Add resource classes

A resource class is one pool of worker machines that jobs can run on. Once the agent has reported its nodes, Arena suggests one class for each GPU model and GPU count it found, with the CPUs, memory, node count and node placement label filled in from the nodes.

### Web app

Select the cluster on the **Bring your own compute** tab and find **Suggested classes** below **Resource classes**. Click **Create** on each one you want. For hardware Arena didn’t suggest, click **Add resource class**. See [Resource classes](resource-classes.md).

### CLI

`arena cluster connect` and `arena cluster register` list the suggestions and ask `Create these classes?`. Pass `--yes` to create them without asking. In a script without `--yes`, they print the suggestions and create nothing.

On **Nebius** and **AWS**, `--register-and-install` already added a class for each GPU worker group in the spec, named `<cluster>-<worker name>`, and skips suggestions. Add more only for hardware outside the spec. On Nebius, `arena cluster register-classes` adds more from the CLI; see [Resource classes](resource-classes.md#from-the-cli).

A created suggestion is an ordinary class: edit, turn off or delete it like any other. Arena doesn’t suggest a shape that an existing class already selects. When **Suggested classes** asks you to upgrade the agent, run `arena cluster upgrade`: older agents don’t report node CPU and memory.

## Step 6: Check that it works

1. The cluster shows **Connected**, and **Health** has no **Failing** check.
2. Run a smoke test (see [Check that the cluster can run jobs](#check-that-the-cluster-can-run-jobs)):
   ```bash
   arena cluster smoke --name corp-k8s --context '<kube-context>'
   ```
3. In a test experiment, open **Training resources**. A row ending in **(BYOC)** appears for the GPU type of each enabled class.
4. Pick it, train, and check the experiment leaves **Pending**. If it doesn’t, see [Troubleshooting](#troubleshooting).

## Provision on AWS

The CLI creates an EKS cluster, its network and its storage in your AWS account with Terraform, then registers it and installs the agent.

### What you need

- The `aws` CLI, signed in as an IAM user or role in the account you want to use. The account root user doesn’t work, because EKS can’t authenticate it.
- Permission for that identity to create IAM users, policies and access keys. The CLI uses it to create an IAM user named `byoc-provisioner` with a policy named `byoc-provision`, stores that user’s access key in the AWS CLI profile `byoc`, and runs Terraform as that user. The policy allows EC2, EKS, EFS, Elastic Load Balancing, Auto Scaling and S3, plus the IAM actions the cluster’s roles need. `plan` sets this up too.
- `terraform` 1.10 or later, `kubectl` and Helm 3.

### Write the spec

```bash
arena cluster generate-spec --provider aws --name lab-aws
```

This writes `lab-aws.yaml`. The parts to check:

```yaml
provider: aws
name: lab-aws                 # also the EKS cluster name
arena:
  storage:
    bucket: lab-aws-data      # experiment data; Terraform creates it
    endpoint: https://s3.eu-west-1.amazonaws.com   # change to match aws.region
  inference:
    domain: lab-aws.inference.agilerl.rlops.ai
terraform_state:
  bucket: lab-aws-tfstate     # must differ from arena.storage.bucket
aws:
  region: eu-west-1
  system: {min_node_count: 2, max_node_count: 10, instance_type: t3.xlarge}
  workers:
    - name: gpu
      min_node_count: 0
      max_node_count: 4
      instance_type: g6.xlarge
      num_cpus: 16
      num_gpus: 1
      memory_gib: 64
      gpu_type: l4
      vram_gib: 24
  object_storage:
    size_gib: 1024
```

- **Region.** If you change `aws.region`, change the region in `arena.storage.endpoint` too. The template doesn’t do it for you.
- **Workers.** `workers` is empty in the template, which gives a cluster with no GPUs. Add a group for each kind of GPU machine. A GPU group needs `num_cpus`, `memory_gib`, `gpu_type` and `vram_gib` as well as the instance type. Each GPU group becomes a resource class named `lab-aws-<name>`, sized to `max_node_count`.
- **Network.** There are no VPC or subnet fields. Terraform creates a VPC with two public subnets in the region. The account is the one your `aws` credentials belong to.

`kubernetes_version` defaults to `1.36`. Set `aws.shared_filesystem.provision: true` to add an EFS file system and a StorageClass named `arena-shared`.

### Plan and provision

```bash
arena cluster plan --spec lab-aws.yaml --create-state-bucket
arena cluster provision aws --spec lab-aws.yaml \
  --create-state-bucket --register-and-install
```

`--create-state-bucket` creates the state bucket if it’s missing. The positional `aws` is optional, but if you give it, it must match `provider` in the spec.

Run every `arena cluster` command for this cluster from the same folder. The CLI keeps its Terraform state, the state bucket’s credentials and the kubeconfig in `./arena-cluster-lab-aws/`, or in the folder you pass with `--state-dir`.

### Use the cluster with kubectl

The CLI writes the cluster’s kubeconfig to `./arena-cluster-lab-aws/kubeconfig`. It doesn’t change `~/.kube/config`. To point `kubectl` and `helm` at the new cluster:

```bash
export KUBECONFIG=$PWD/arena-cluster-lab-aws/kubeconfig
```

The kubeconfig gets its credentials from the `aws` CLI, so keep the CLI installed on that machine.

Without `--register-and-install`, `provision` stops after creating the cluster and prints the register command to run next, with this `KUBECONFIG` set.

### Tear it down

```bash
arena cluster destroy --spec lab-aws.yaml
```

This keeps the experiment-data bucket. `--delete-storage` deletes it too, and `--all` also removes the state bucket. If the cluster is registered in Arena, the CLI asks whether to unregister it.

## Networking and advanced settings

All optional. They sit under **Networking and advanced** on the form, and have matching flags on `arena cluster register`.

**Domain** is where deployments on this cluster are served. The form fills in `<cluster>-<org id>.byoc.agilerl.com`. Keep it and Arena handles DNS and HTTPS for you: it publishes a wildcard record for the domain once your Gateway or Ingress controller has an address, and issues and renews the certificate. The records track the address the agent reports and are removed when you disable or archive the cluster. Type your own domain instead and you point `*.<your domain>` at your load balancer yourself, and set **TLS secret name** to a certificate you manage. Clear both **Domain** and **Hostname template** to skip inference DNS.

**Hostname template** is the host part only. It defaults to `inference-{deploymentId}`, and Arena joins it to the domain as `<hostname>.<domain>`.

Route with Gateway API (**Gateway name**, **Gateway namespace**, **Gateway section name**) or with Ingress (**Ingress class name**). With Ingress, set `routing.ingressControllers` in the agent’s Helm values to the Service in front of your Ingress controller, or there is no address to publish.

**Ray data storage class** and **Ray data PVC size** give every node in a run the same volume. Use a `ReadWriteMany` StorageClass your platform team already runs (NFS, CephFS or similar). Leave them empty to use the cluster’s default.

**Preprocessing resource class** pins dataset preprocessing to one of this cluster’s classes.

## Choose the Kubernetes cluster

Every command that touches Kubernetes (`preflight`, `connect`, `register --install`, `upgrade`, `smoke`, `unregister`) takes `--kubeconfig` and `--context`. Without `--context` it uses the current context of `--kubeconfig`, of `./arena-cluster-NAME/kubeconfig`, or of your default kubeconfig. For the default kubeconfig it shows the context and API server and asks first; in a script it stops and asks for `--context`.

Arena remembers each cluster by the UID of its `kube-system` namespace, taken at `connect` or `register --install`, or from the agent’s first check-in for a cluster registered earlier. A command pointed at a different Kubernetes cluster stops before it changes anything, with `Kubernetes context … is not Arena cluster '…'`. Pass `--context` for the right cluster, or register the other cluster under its own name.

## Move a cluster to another Kubernetes cluster

To keep an Arena cluster, its resource classes and its history while it runs somewhere else, move it rather than registering a new one. Only an Arena platform admin can move a cluster: AgileRL support on Arena at agilerl.com, or whoever runs your self-hosted Arena. Move it when no runs or deployments are active on the cluster. Arena refuses the move while an experiment, a Ray cluster, or an enabled deployment is still active.

1. Cut off and remove the agent on the old Kubernetes cluster:
   ```bash
   arena cluster revoke-token --name corp-k8s
   helm uninstall arena-byoc-agent --namespace arena --kube-context '<old-context>'
   ```

   Revoke first: an old agent that still checks in would tie the cluster to the old Kubernetes cluster again.
2. Ask your Arena platform admin to move `corp-k8s`. Arena forgets the old Kubernetes cluster, and your organization’s **Activity log** shows **Cluster Moved To Another Kubernetes Cluster**.
3. Connect the new Kubernetes cluster:
   ```bash
   arena cluster connect --name corp-k8s --context '<new-context>'
   ```

   This issues a new enrollment token and installs the agent. Arena records the new Kubernetes cluster on the agent’s first check-in, and from then on refuses any other one.

   An agent already installed on the new cluster before the move stopped with `Arena refused this cluster's identity: conflict`. Its pod restarts by itself within a few minutes; to pick up the move at once, restart it:
   ```bash
   kubectl rollout restart deployment/arena-byoc-agent --namespace arena --context '<new-context>'
   ```

The agent keeps its credential in the Secret `<release>-credential` in its namespace (`arena-byoc-agent-credential` for the default release). Reconnecting with a new token, as above, needs nothing from the old cluster. If you copy the credential Secret from the old cluster instead of reconnecting, give it the name that matches the new Helm release, or the agent falls back to its spent enrollment token and Arena refuses it.

## Approve and apply agent upgrades

Arena upgrades the agent from the web app when the new release keeps the same Kubernetes permissions. When a release adds or removes ClusterRole rules, Arena holds the upgrade until a cluster admin applies it, so you choose what the agent may do in your cluster.

A held upgrade shows on the cluster as **Needs your approval**, with the badge **Agent upgrade held**. The card lists each change: the ClusterRole, **Added** or **Removed**, the resource, and the verbs. Apply it one of two ways:

- **With the Arena CLI.** As a cluster admin, run:
  ```bash
  arena cluster upgrade --name corp-k8s --context '<kube-context>'
  ```

  The CLI prints each change, one block per ClusterRole with `+` for added and `-` for removed rules, asks `Apply these ClusterRole changes?`, then runs the Helm upgrade. In a script, pass `--yes` once you have read the changes; without it the command stops and asks you to run it in a terminal.
- **Without the Arena CLI.** Open **Apply without the Arena CLI** on the card. Download the ClusterRole manifest (`arena-byoc-agent-rbac-<cluster>.yaml`), apply it with the `kubectl --context '<kube-context>' apply -f …` command shown, then click **ClusterRoles applied, upgrade agent**. Arena then upgrades the agent from inside the cluster. When the card has no such option, use the CLI.

An upgrade that keeps the same permissions shows as **Agent update available** (**A newer agent release is available for this cluster.**). Click **View update** to see the component versions, then **Upgrade agent**. On older agents it shows the `arena cluster upgrade` command instead.

While an upgrade request is open, the cluster shows **Upgrading agent** and new runs on it wait, showing **Waiting for cluster upgrade**. Deployments already serving keep serving. The request closes when the agent reports the new release, or after 70 minutes, when Arena drops it and the waiting runs start. If an upgrade attempt fails, the agent rolls back to the release it had and reports `agent upgrade failed:` with Helm’s error. It starts another upgrade Job on its next poll, within a minute, during the first 20 minutes of the request. After that it starts no new Job, though one already running can still be in the cluster when **Upgrading agent** goes. When the message says `stopped after … upgrade Jobs failed`, three Jobs failed because the chart does not render or Kubernetes refused a write, and the agent starts no further Job for this release. **Upgrade agent** asks for the same release, so it doesn’t start one either. Wait until the Job `arena-byoc-agent-upgrade` has finished, then run `arena cluster upgrade` from a machine with cluster access.

You can also upgrade from the terminal with `arena cluster upgrade` whenever no `arena-byoc-agent-upgrade` Job is running. It downloads the current chart and runs `helm upgrade --install` for the agent release only, and leaves the token, the tunnel Secret and the storage chart alone. It upgrades an agent that is already installed; to install one, use `connect`. An agent installed by Argo CD or Flux is upgraded from git; see [GitOps install](#gitops-install-argo-cd-or-flux).

## Rotate or revoke the agent credential

The agent signs in to Arena with its own credential, kept in the Secret `arena-byoc-agent-credential` in its namespace. The install gives it a one-time enrollment token, which it trades for that credential on its first call, and it renews the credential itself.

**Rotate** when a policy asks you to. Arena asks the agent to renew, and the agent picks the new credential up on its next poll, within a minute. The current credential keeps working until the agent uses the new one, so nothing goes down and there is nothing to install.

**Revoke now** when you think a credential leaked. Every credential of the cluster stops working at once, and the agent’s next call to Arena is refused. Training and inference on the cluster stop reconciling until you reconnect it.

### Web app

Select the cluster and open its actions menu (**⋯**):

- **Rotate agent credential** asks the agent to renew.
- **Revoke credentials now**, then confirm, cuts the agent off. To reconnect, choose **Issue agent token** and run the install the dialog shows. The new enrollment token is shown once, in that dialog.

### CLI

Ask the agent to renew. The command needs no kubeconfig and the agent does not restart, but the agent must have connected at least once:

```bash
arena cluster rotate-token --name corp-k8s
```

Cut the agent off:

```bash
arena cluster revoke-token --name corp-k8s
```

Reconnect it with `arena cluster connect --name corp-k8s --context '<kube-context>'`, which issues a new enrollment token and installs it. Both commands take `--yes` to skip the confirmation prompt. A CLI older than this behaviour stops with `this arena CLI is too old` on `rotate-token`; upgrade it with `uv tool upgrade agilerl`.

If the agent has not picked a renewal up a day later, the cluster shows **Credential renewal pending** and org admins get an email. Its current credential still works. Check that the agent is running, and upgrade it if it is older than the release that renews its own credential.

**Agent token** shows whether the cluster has an active credential, and **Token last used** shows when the agent last signed in with one. If Arena refuses the agent’s credential, the cluster says **Agent is using an expired credential** or **Agent is using a revoked credential**, with what to do.

Re-registering a cluster keeps its token. `arena cluster connect` and `arena cluster register` issue a new token only with `--rotate-token`; the previous one then keeps working for 24 hours, and the cluster shows **Token renewal pending** with the time it stops. That is for an agent too old to renew its own credential. `arena cluster register --name corp-k8s --rotate-token`, without `--install`, leaves it to you to put the new token in the cluster within those 24 hours.

**Disable** in the actions menu also revokes every credential, and stops training and inference on the cluster’s classes. To bring the cluster back, click **Restore**, then issue a new token and reinstall.

## Check that the cluster can run jobs

```bash
arena cluster smoke --name corp-k8s --context '<kube-context>'
```

The agent installs a small training release with its own ServiceAccount, the same way it installs a job, waits until the release’s Ray head is Ready, and removes it. The release asks for no GPU and mounts no storage, so it reads and writes none of your data. The command prints whether the smoke passed. When it fails, it prints the reason the agent saw, such as an RBAC rule Kubernetes refused or an image the node could not pull.

The agent picks the smoke up on its next poll, within a minute. The release uses the training image of the cluster’s oldest resource class, so add a class first. An agent older than this Arena release does not run smokes: run `arena cluster upgrade` first. Arena runs one smoke per cluster at a time; running the command again while one runs waits for that one. A smoke fails when the agent reports nothing on it for 90 minutes. A new smoke starts only once the agent has confirmed that the last one’s release is removed.

`--timeout` is how long the CLI waits (default 3600 seconds). `--kubeconfig` and `--context` select the cluster, which must be the one Arena has on record.

## Remove a cluster

```bash
arena cluster unregister --name corp-k8s --context '<kube-context>'
```

Arena stops giving the cluster new runs and marks it **Removing**. A cluster that still has experiments, deployments or Ray clusters is refused, and the error lists them; add `--stop-runs` to stop them first. Once nothing is running, the agent deletes the job namespaces it created. Arena then archives the cluster and its classes, revokes its tokens and deletes its DNS records, and the CLI uninstalls the agent. The CLI waits up to 10 minutes (`--wait-timeout`); if that runs out, run the same command again.

An agent that is offline, or too old to clean up after itself, is archived straight away and the CLI prints a command that removes its job namespaces once you can reach the cluster. If that cluster still has runs, Arena asks for `--force`, which ends them without the agent.

Add `--uninstall-storage` to also remove a bundled MinIO; that deletes the checkpoints, metrics and datasets in it. `--keep-agent` leaves the agent installed, and `--yes` skips the prompts without uninstalling anything you didn’t ask for.

For a cluster the CLI provisioned, `arena cluster destroy --spec lab-cluster.yaml` tears down the cloud resources. The experiment-data bucket is kept unless you pass `--delete-storage`.

From the web app, **Archive** the cluster. It does the same as `unregister` without flags, except that it doesn’t uninstall the agent: the cluster shows **Removing** until the agent has cleaned up, and its tokens stay until then. An agent that can’t clean up, or is offline, is archived at once and the response has the cleanup command. Afterwards, remove the agent yourself with `helm uninstall arena-byoc-agent --namespace arena`.

## Troubleshooting

These are the messages the CLI and the cluster show, and what to do about each.

### Preflight and connect

| Message                                                                                    | What to do                                                                                                                                                                        |
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `helm is not on PATH. Install Helm 3, then run this again.`                                | Install Helm 3 on the machine running the CLI                                                                                                                                     |
| `No --context or --kubeconfig given. Pass --context … to use the current context`          | The CLI will not guess the cluster in a script. Pass `--context`                                                                                                                  |
| `No Kubernetes context to use from …`                                                      | The kubeconfig has no such context. Check `kubectl config get-contexts` and pass `--kubeconfig` and `--context`                                                                   |
| `Could not read the kube-system namespace UID`                                             | The context cannot reach the cluster, or you may not read namespaces. Check `kubectl --context '<kube-context>' get namespace kube-system`                                        |
| `Preflight failed: … Fix them and run again; nothing was changed in Arena or the cluster.` | Fix each `FAIL` row using its fix column, then run again                                                                                                                          |
| `You may not create …`                                                                     | Use a kubeconfig with cluster-admin                                                                                                                                               |
| `Kubernetes 1.x` with `FAIL`                                                               | Upgrade the cluster to 1.30 or later                                                                                                                                              |
| `A privileged pod is refused in namespace …`                                               | Label the agent namespace `pod-security.kubernetes.io/enforce=privileged` (create it first if needed), or exempt it from the policy that refused the pod                          |
| `StorageClass …, set for Ray data, does not exist`                                         | Create that StorageClass, or pass another `--ray-data-storage-class-name`                                                                                                         |
| `Arena agents already in this cluster: …`                                                  | Unregister the cluster that agent belongs to, or remove it with `helm uninstall --namespace <namespace> <release>`                                                                |
| `The agent has not reached Arena after …s`                                                 | Check the agent pod runs (`kubectl get pods -n arena`). Check the cluster can reach the Arena gateway over UDP and Arena over HTTPS. The message ends with the agent’s last error |
| `The agent is connected but sent no health report within …s`                               | The agent is older than the chart Arena serves. Run `arena cluster upgrade`                                                                                                       |
| `… is connected, but its health report has failing checks`                                 | Fix the failing checks shown above the message. The agent reports again within 10 minutes                                                                                         |
| `Re-run with --yes to create them, or create them on the cluster page in Arena.`           | The CLI did not create the suggested classes because it could not ask. Run again with `--yes`, or click **Create** under **Suggested classes**                                    |

### Wrong cluster

| Message                                                                                                              | What to do                                                                                                                                                                                                               |
|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Kubernetes context … is not Arena cluster '…', which runs in cluster UID …. Pass --context for that cluster.`       | Your context points at a different Kubernetes cluster than the one this Arena cluster was installed in. Pass `--context` for the right one. Nothing was changed                                                          |
| `Kubernetes cluster … is not Arena cluster …. Point kubectl at that cluster, or register this one under a new name.` | Arena refused a register, rotation or smoke for the same reason. To connect a second cluster, give it its own name. To run this Arena cluster here instead, [move it](#move-a-cluster-to-another-kubernetes-cluster)     |
| Agent log: `Arena refused this cluster's identity: conflict`                                                         | The agent runs in a Kubernetes cluster other than the one Arena recorded, and stops. [Move the cluster](#move-a-cluster-to-another-kubernetes-cluster) and restart the agent, or reinstall the agent where it ran before |
| `Arena has no cluster UID for '…' yet. Its agent records one on its next heartbeat.`                                 | The cluster was registered before Arena recorded cluster identities. Nothing to do: the next heartbeat records it                                                                                                        |

### Token

| Message                                                                                                      | What to do                                                                                                                                                                                                                                                                        |
|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Arena kept the agent token of cluster …, but namespace … has no token Secret …. Re-run with --rotate-token` | The cluster is registered but the agent was never installed here. Run the same command with `--rotate-token`                                                                                                                                                                      |
| `Cannot --install without an agent token`                                                                    | Your Arena CLI is too old. Run `uv tool upgrade agilerl`                                                                                                                                                                                                                          |
| **Token renewal pending** on the cluster                                                                     | A re-register with `--rotate-token` issued a new token; the previous one still works until the time shown. Check the agent’s token Secret holds the new token before then, or run `arena cluster connect --rotate-token` again. The notice clears when the previous token expires |
| **Credential renewal pending** on the cluster                                                                | The agent has not picked up a renewal Arena asked for a day ago. Its current credential still works. Check the agent is running, and upgrade it if it is older than the release that renews its own credential                                                                    |
| **Agent is using an expired credential**                                                                     | The agent can no longer renew it. Run `arena cluster connect --name <name>` again: it installs a new token when the cluster has none, and with `--rotate-token` when the cluster still has one the agent lost                                                                     |
| **Agent is using a revoked credential**                                                                      | The credential was revoked, with **Revoke credentials now** or by disabling the cluster. Run `arena cluster connect` again, or issue a new agent token and reinstall                                                                                                              |

### Health checks

| Check shows                                                                | What to do                                                                                                                                                                         |
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Nodes**: `none with allocatable nvidia.com/gpu`                          | Install the NVIDIA GPU Operator or device plugin                                                                                                                                   |
| **Nodes** or **StorageClass**: `unavailable: needs approval upgrade`       | The agent cannot read nodes or StorageClasses yet. [Approve the held upgrade](#approve-and-apply-agent-upgrades)                                                                   |
| **StorageClass**: `no default StorageClass`                                | Mark one StorageClass default (annotation `storageclass.kubernetes.io/is-default-class: "true"`) or set the cluster’s **Ray data storage class**                                   |
| **Tunnel**: `the tunnel has not completed a handshake`                     | Check the cluster can send UDP to the gateway host and port, and that the agent pod’s `wireguard` container is running                                                             |
| **Storage**: `the agent could not reach its storage`                       | Check the storage Secret’s keys, the endpoint, and the bucket policy                                                                                                               |
| **Credential**: `the cluster has no active agent token`                    | Connect the cluster again with `arena cluster connect --name <name>`, which issues a new enrollment token and installs it                                                          |
| **Image pull credential** failing                                          | The agent could not renew its registry login; the detail says why. Check the agent can reach Arena and read its log. If the login has already expired, run `arena cluster upgrade` |
| **Agent permissions**: `the agent's ClusterRoles differ from this release` | [Approve the held upgrade](#approve-and-apply-agent-upgrades)                                                                                                                      |
| **One agent**: `other Arena agents in this cluster`                        | Keep one agent per cluster: `helm uninstall -n <namespace> <release>` for the others                                                                                               |
| `the agent could not read …`                                               | Read the agent’s log: `kubectl logs deploy/arena-byoc-agent -c operator -n arena`                                                                                                  |

### Smoke test and upgrades

| Message                                                                                                                  | What to do                                                                                                                                                                                                                                                                                                          |
|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `This cluster has no resource class.`                                                                                    | Create a class first; the smoke uses its training image                                                                                                                                                                                                                                                             |
| `The agent of cluster … has not reported that it runs smokes.`                                                           | Run `arena cluster upgrade`, then wait for the next heartbeat                                                                                                                                                                                                                                                       |
| `Smoke failed on cluster …: …`                                                                                           | The reason is the agent’s. Fix it (often an RBAC rule or an image pull) and run the smoke again                                                                                                                                                                                                                     |
| `This upgrade changes the agent's ClusterRoles and needs your approval. Run it in a terminal to confirm, or pass --yes.` | Run `arena cluster upgrade` in a terminal, or add `--yes` once you have read the changes                                                                                                                                                                                                                            |
| `Helm release … is not installed in namespace ….`                                                                        | `upgrade` only upgrades an installed agent. Install it with `arena cluster connect`                                                                                                                                                                                                                                 |
| `agent upgrade failed: …` on the cluster                                                                                 | The agent rolled back that attempt. It starts another Job on its next poll, within a minute, for the first 20 minutes of the request. After that it starts no new Job. Leave a running `arena-byoc-agent-upgrade` Job to finish                                                                                     |
| `agent upgrade failed: …; stopped after … upgrade Jobs failed`                                                           | Three Jobs failed because the chart does not render or Kubernetes refused a write, and the agent starts no further Job for this release. **Upgrade agent** asks for the same release, so it does not start one either. Wait until the Job `arena-byoc-agent-upgrade` has finished, then run `arena cluster upgrade` |
| **Degraded** with no error shown                                                                                         | The agent has not checked in for 3 minutes. Check its pod and its network access to Arena                                                                                                                                                                                                                           |
