> For AI agents: the complete documentation index is available at https://docs.tessl.io/llms.txt, the full documentation bundle is available at https://docs.tessl.io/llms-full.txt.

# Run Tessl work on your own Kubernetes cluster

The Tessl controller runs on your Kubernetes cluster. It asks Tessl for work, such as an eval's solves or a launch run, and runs each piece of work, called an attempt, as one Kubernetes Job on your nodes. The controller connects out to Tessl; Tessl never connects in to your cluster.

This page is for the platform team that installs it. It covers what the cluster needs, what the Helm chart installs and with which rights, which hosts the attempts reach, what reaches Tessl, and how to run, rotate and remove the controller.

## Before you start

Tessl registers the controller for your organization and gives you:

- a **selector**, such as `controller-acme`, that names your controller when you start work on it;
- a **controller token**, which the controller presents to Tessl. Tessl keeps only its hash;
- the **chart package**, `tessl-controller-<version>.tgz`, and **values files** that name the controller, install and reference worker images by digest.

Tell Tessl at registration which [model mode](#models-and-what-reaches-tessl) you want. The mode is part of the registration, and the chart must match it.

## Cluster requirements

- **Kubernetes 1.31 or later.** The chart refuses an older cluster.
- **A network plugin that enforces NetworkPolicy**, such as Calico or Cilium. The chart closes the attempts' network with NetworkPolicies. On a plugin that does not enforce them, the controller's canary fails and the controller claims no work. Amazon EKS on Fargate does not enforce them; see [Amazon EKS](#amazon-elastic-kubernetes-service-eks).
- **Pod Security `restricted`** on the runs namespace. When the chart creates the namespace it enforces `restricted`. If you create the namespace yourself, it needs `baseline` or stricter, the `RuntimeDefault` seccomp profile allowed, and nothing that mounts a service account token into its pods.
- **Linux nodes, amd64 or arm64, and glibc worker images.** The reference worker image is Ubuntu. An image you build for attempts must be glibc based, not musl based such as Alpine.
- **Node disk and memory for the attempts.** By default each attempt requests and is limited to 2 CPUs, 4 GiB of memory and 20 GiB of ephemeral storage, and 4 attempts run at once (`capacity.maxConcurrent`). Size the nodes that run attempts for that many attempts, on top of their other pods.
- **Image pulls.** Your nodes pull the three images from Tessl's registry or from your own mirror. Image pulls go through your nodes, not through the egress proxy.

## What the chart installs

The controller gets only namespaced rights. The chart installs no CRD, webhook, ClusterRole or ClusterRoleBinding. The only cluster-scoped objects it touches are the two Namespaces: by default it creates them, so the installer needs `get`, `create` and `patch` on those two Namespaces; with `namespaces.create: false` it only looks them up, and the installer needs `get` on each by name.

- **Two namespaces**: `tessl-system` for the controller and `tessl-runs` for the attempts' Jobs. With `namespaces.create: false` it uses two namespaces you created.
- **The controller**: one Deployment and ServiceAccount in `tessl-system`, and a ConfigMap with the Job settings. It serves `/healthz`, `/readyz` and `/metrics` on port 8080.
- **The egress proxy**: a Deployment, Service and ServiceAccount in `tessl-system`. It opens tunnels on port 443 to the hosts on its list only. It does not inspect TLS.
- **Two NetworkPolicies**: `tessl-runs-egress` in `tessl-runs`, which lets the attempts' pods connect only to the egress proxy, with no DNS and no access to the Kubernetes API, as long as no other NetworkPolicy in `tessl-runs` allows them more, and `tessl-egress-proxy-ingress` in `tessl-system`, which lets only those pods reach the proxy.
- **A Role and RoleBinding in each namespace**:
  - In `tessl-runs` the controller may create, get, list, watch, patch and delete Jobs; get, list and watch pods; create and delete Secrets, for each attempt's run key; and create and patch Events. It cannot read a Secret, read a pod's logs, create a pod or exec into one.
  - In `tessl-system` it may create Leases and get and update the `tessl-controller` Lease, create and patch Events, and get the egress proxy's Service.
- **The `tessl-worker` ServiceAccount** the attempts' pods run as. Nothing binds it, and its token is never mounted.
- **A ResourceQuota** on `tessl-runs` of `capacity.maxConcurrent` + 1 pods: the attempts and the controller's canary.

Keep nothing else in `tessl-runs`. The controller's Secret rights cover every Secret there, and a pod without the controller's label is not confined by its NetworkPolicy. Keep `tessl-runs` free of other NetworkPolicies that allow egress too, which matters most when you create the namespace yourself. NetworkPolicies add up: one that allows DNS or an internal subnet opens that egress beside the proxy, and the controller's canary, which tries only a public address and the Kubernetes API, does not catch it.

## Hosts that leave the cluster

The **controller** connects to the Tessl API only. It uses the cluster's `HTTPS_PROXY` and `NO_PROXY` when they are set on its pod.

The **attempts** connect only through the egress proxy, which opens tunnels on port 443 to these hosts:

| Purpose                                  | US instance                                                  | EU instance                                                  |
| ---------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Tessl API                                | `api.tessl.io`                                               | `api.eu.tessl.io`                                            |
| `tessl-runner` download                  | `tileworks-tessl-runner-releases.s3.us-east-1.amazonaws.com` | `tileworks-tessl-runner-releases.s3.us-east-1.amazonaws.com` |
| Inputs and outputs                       | `tileworks-recipe-runner-jobs.s3.us-east-1.amazonaws.com`    | `tsl-app-eu-recipe-runner-jobs.s3.eu-west-1.amazonaws.com`   |
| Tessl model gateway (Tessl mode only)    | `llms.tessl.io`                                              | `llms.eu.tessl.io`                                           |
| Source and tools (`egress.allowedHosts`) | `github.com`, `api.github.com`, `install.tessl.io`           | `github.com`, `api.github.com`, `install.tessl.io`           |

The chart's `examples/values-us.yaml` and `examples/values-eu.yaml` set the API and instance hosts. Add hosts your attempts need, such as a package registry, to `egress.allowedHosts`. No model provider is on the list: attempts reach models through Tessl's gateway or through yours.

The egress proxy itself needs DNS and outbound port 443 to these hosts, from `tessl-system`. To send its tunnels through your own proxy, set `egress.upstreamProxy`. To see which hosts the attempts ask for before you enforce the list, set `egress.mode: observe`: the proxy then opens a tunnel to any public host and logs each one it would refuse.

## Models and what reaches Tessl

The controller runs in one of two model modes, set at registration and in the chart's `modelGateway.mode`:

- **Tessl mode** (`modelGateway.mode: tessl`, the default): Tessl mints each attempt a short-lived key on its model gateway, and the agents' model requests go to it.
- **Customer mode** (`modelGateway.mode: customer`): the agents' model requests go only to your gateway, such as a LiteLLM you run. Tessl mints no model key, and neither the registration nor the attempts' job settings carry your gateway's address or key to Tessl. Error records can name the address, as described below. Your gateway must list each model the attempts use, under the names Tessl's registration maps them to.

In both modes, this reaches Tessl:

- **Control calls from the controller**: claim, heartbeat, finish, release and adopt calls, and the list of attempts it holds. They carry the controller's instance id (its pod's name), the attempt's Job namespace, name and uid, and, when an attempt ends, its exit status and failure type and message.
- **Calls from each attempt's worker**: fetching the attempt's job with the attempt's run key, and a fresh upload URL when one has expired.
- **Uploaded outputs**: the worker uploads, through presigned URLs, to Tessl's bucket: the work's declared outputs, such as the code an eval's solve wrote and its score; the run metadata, which holds the agent's transcript, uploaded only after the runner redacts credentials from it; and the run's system log. Run metadata is also uploaded every 90 seconds while the attempt runs, so the run shows progress.
- **Timeline events for launch runs**: for a launch run, after the system log is uploaded, the worker tells Tessl its line count and storage key, and Tessl shows the run's timeline from it. Other attempts make no timeline call.

In Tessl mode, every model request also reaches Tessl's gateway: the prompts, and the code and files the agents send to the model.

In customer mode, model requests reach Tessl only as the transcript in the run metadata. When a request to your gateway fails, the runner's error record, which is uploaded, can name your gateway's address.

The controller's and workers' logs stay in your cluster. Tessl does not read pod logs.

To use customer mode, set the gateway in your values, and create a Secret with your gateway's key in the runs namespace. The chart creates `tessl-runs` when you install it, so create the Secret after `helm install` and before the controller's token Secret (steps 3 and 4 of [Install](#install)); if you created the namespaces yourself, create it at any time before then:

```yaml
modelGateway:
  mode: customer
  baseUrl: https://litellm.ai-gw.svc.cluster.local
  secretName: model-gateway
```

```bash
kubectl create secret generic model-gateway -n tessl-runs \
  --from-file=api-key=<path to the key>
```

The gateway URL must be `https` on port 443, with a fully qualified host name. Its certificate must be one the agents trust by default. Switch the mode, or change the gateway, only while no attempt is running: a running attempt keeps the gateway it started with, and the egress proxy stops letting it reach that gateway at once.

## Install

1. Verify the images with cosign, as the chart's `README.md` describes under "Verify the images".
2. Write your values file, `my-values.yaml`:

   ```yaml
   tessl:
     controllerToken:
       secretName: tessl-controller-token
   ```

   Pass the region's example values and Tessl's image values files before your own.
3. Install the release in a namespace the chart does not create, such as `default`:

   ```bash
   helm install tessl tessl-controller-<version>.tgz --namespace default \
     --values values-us.yaml --values image-values.yaml --values my-values.yaml
   ```
4. Create the controller token's Secret in `tessl-system`. The chart never holds the token. The controller starts once the Secret exists:

   ```bash
   kubectl create secret generic tessl-controller-token -n tessl-system \
     --from-file=token=<path to the controller token>
   ```
5. Wait for the controller to become ready:

   ```bash
   kubectl rollout status deployment/tessl-controller -n tessl-system
   ```

   The controller is ready once its canary has passed: a Job in `tessl-runs` that checks that a direct connection out fails and a tunnel to the Tessl API through the egress proxy opens. Until then it claims no work, and `kubectl get events -n tessl-system` and the controller's log say why.
6. Check that Tessl accepts the token. Readiness does not cover it: a controller whose token Tessl refuses is still ready, and claims no work. This lists nothing while Tessl accepts the token:

   ```bash
   kubectl get events -n tessl-system --field-selector reason=TesslUnreachable
   ```

   An event that ends in `status 401` means Tessl refused the token.

## Run an eval on your cluster

Pass your controller's selector to `tessl eval run`:

```bash
tessl eval run ./my-plugin --controller controller-acme
```

The eval's solves run as Jobs in `tessl-runs`. Watch them with:

```bash
kubectl get jobs -n tessl-runs -l tessl.io/controller-id
```

Without `--controller`, the eval runs on Tessl's sandboxes.

## Build your own worker image

The reference worker image, `run.image`, carries the tools and agent CLIs an attempt uses: git, gh, tessl, Claude Code and Codex among them. To add your own tools, build an image `FROM` the reference image by its digest:

```dockerfile
FROM <repository>@sha256:<digest of run.image>
USER root
RUN apt-get update \
  && apt-get install -y --no-install-recommends <your packages> \
  && rm -rf /var/lib/apt/lists/*
USER 1001
```

Keep these, or the attempts fail:

- `tessl-runner` at `/usr/local/bin/tessl-runner`, or set `run.runnerPath` to where your image has it;
- uid 1001 able to write `/workspace`, or change `worker.runAsUser` and `run.workVolumePath` to match;
- a glibc Linux base, for each architecture your nodes run.

Push it to your registry, then set `run.image` to it by digest and upgrade the release:

```bash
helm upgrade tessl tessl-controller-<version>.tgz --namespace default \
  --values values-us.yaml --values image-values.yaml --values my-values.yaml \
  --set-json 'run.image="<your repository>@sha256:<digest>"'
```

`run.image` is versioned on its own: it needs no matching controller version.

## Rotate the controller token

A registration can hold more than one token at once, so you can rotate without downtime:

1. Ask Tessl for a new token on your registration. The old one keeps working.
2. Replace the Secret's token with the new one:

   ```bash
   kubectl create secret generic tessl-controller-token -n tessl-system \
     --from-file=token=<path to the new token> \
     --dry-run=client -o yaml | kubectl replace -f -
   ```
3. Restart the controller, which reads the token only when it starts, and wait for it:

   ```bash
   kubectl rollout restart deployment/tessl-controller -n tessl-system
   kubectl rollout status deployment/tessl-controller -n tessl-system
   ```

   A restart does not stop the attempts that are running. The new controller adopts them.
4. Check that Tessl accepts the new token: no new `TesslUnreachable` event from the new controller pod, as in the last install step.
5. Ask Tessl to revoke the old token.

If a token has leaked while attempts are running, ask Tessl to revoke the whole registration: that also cancels its running attempts and revokes their run keys.

## Uninstall

Stopping the controller releases the attempts it holds without reporting how they end, so Tessl fails them. The chart has no way to drain. Check how many attempts it holds first, in `tessl_controller_held_attempts` on the controller's `/metrics`, and remove the controller while it is zero or you accept those failures.

`helm uninstall` deletes the chart's own objects, the egress proxy and both NetworkPolicies among them. It does not delete the attempts' Jobs, which the controller created, so an attempt's pod still running after it would have no network confinement. Stop the controller and delete the Jobs first, while the NetworkPolicies still confine their pods:

```bash
kubectl scale deployment/tessl-controller -n tessl-system --replicas=0
kubectl wait pods -n tessl-system -l app.kubernetes.io/component=controller --for=delete --timeout=5m
kubectl delete jobs -n tessl-runs -l tessl.io/controller-id --cascade=foreground
kubectl delete jobs -n tessl-runs -l tessl.io/canary-of --cascade=foreground
kubectl get jobs,pods -n tessl-runs -l tessl.io/controller-id
kubectl get jobs,pods -n tessl-runs -l tessl.io/canary-of
```

`kubectl scale` only lowers the replica count. `kubectl wait` returns once the controller's pod has exited, so from then on nothing creates an attempt or canary Job. `--cascade=foreground` makes each delete return only once the Job's pods are gone, and the last two commands list nothing once no attempt or canary Job or pod is left. Then uninstall the release:

```bash
helm uninstall tessl --namespace default
```

Helm keeps both namespaces, and what it did not create in them: the token's Secret and the `tessl-controller` Lease. Delete the namespaces once nothing in them is needed:

```bash
kubectl delete namespace tessl-system tessl-runs
```

Or, to keep the namespaces, delete what is left:

```bash
kubectl delete lease tessl-controller -n tessl-system
kubectl delete secret tessl-controller-token -n tessl-system
```

Then ask Tessl to revoke the registration.

## Azure Kubernetes Service (AKS)

- **Network policy engine.** AKS enforces NetworkPolicy only with a network policy engine. Create the cluster with Azure CNI powered by Cilium (`--network-dataplane cilium`), or with Calico (`--network-policy calico`). A cluster with no network policy engine fails the controller's canary.
- **Azure Container Registry.** You can mirror the three images to Azure Container Registry and pull them from there. Copy them with a tool that copies OCI referrers too, such as `oras cp -r`, so the signatures and SBOMs come along and cosign can verify the copies. Then set `controller.image`, `worker.image` and `run.image` to the mirror by the same digests. A cluster attached to the registry with `az aks update --attach-acr` needs no `imagePullSecrets`.

## Amazon Elastic Kubernetes Service (EKS)

- **No attempts on Fargate.** EKS does not apply NetworkPolicies to Fargate pods ([Amazon EKS network policy considerations](https://docs.aws.amazon.com/eks/latest/userguide/cni-network-policy.html#cni-network-policy-considerations)). A NetworkPolicy is accepted and has no effect, so on a cluster that runs `tessl-runs` on Fargate the chart installs, the controller's canary fails, and the controller stays not Ready and claims no work.
- **Run attempts on EC2 nodes**, such as a managed node group, with a network plugin that enforces NetworkPolicy: the Amazon VPC CNI add-on with network policy turned on (`"enableNetworkPolicy": "true"` in the add-on's configuration values, VPC CNI 1.14 or later, nodes on Linux kernel 5.10 or later; see [Restrict Pod network traffic with Kubernetes network policies](https://docs.aws.amazon.com/eks/latest/userguide/cni-network-policy-configure.html)), or Calico or Cilium. In its default standard mode the VPC CNI lets a new pod's traffic through until its policies are in place. Setting `NETWORK_POLICY_ENFORCING_MODE` to `strict` in the `aws-node` DaemonSet starts new pods with traffic denied instead, for every pod on the cluster, so each one then needs a NetworkPolicy for everything it reaches.
- **The controller may run on Fargate. The egress proxy may not.** No NetworkPolicy selects the controller's pod, so it needs no enforcement. `tessl-egress-proxy-ingress` selects the egress proxy's pod in `tessl-system` and lets only the attempts reach it, so the proxy needs an enforcing node too. The canary does not catch a proxy on Fargate: it tests the attempts' egress, not who else can reach the proxy. To put only the controller on Fargate, give the Fargate profile for `tessl-system` the label selector `app.kubernetes.io/component: controller`.
