Sandbox pools
Sandboxes run on Agent Sandbox
v1.0.0, on the trusted-runc isolation tier. That tier is in production use.
SandboxPool and SandboxLease are served at v1alpha1, so the object shape
can still change between releases; the runtime underneath them is Agent
Sandbox v1.0.0. Set agentSandbox.mode=managed for Kobe-owned management and
child runtimes, or external after installing Agent Sandbox v1.0.0 yourself.
Kobe validates consumed APIs before mounting the Sandbox HTTP API; disabled
mounts no Sandbox endpoints.
Administrators author SandboxPool objects. API callers only choose an allowed
pool, TTL, and optional alias; they cannot provide a Pod spec, namespace,
RuntimeClass, environment values, mounts, PVCs, or target credentials.
Callers: first sandbox. Ports: Ports. Images, kobe-runner, and attach: Images and runner. Chart mode and the admission ledger: Helm.
Runtime ownership
agentSandbox.mode has three values:
disabledis the default. Kobe renders no upstream Agent Sandbox resources and serves no new Sandbox API work. Lifecycle controllers continue cleanup for leases admitted before the mode changed.externalinstalls, upgrades, and uninstalls nothing. You own the Agent Sandbox v1.0.0 core, extensions, CRDs, and controller.managedinstalls the chart-pinned v1.0.0 runtime by controller image digest, retains its CRDs, RBAC, and controller on Helm uninstall, and publishes a retained childBootstrapConfigfrom the same manifest.
Kobe checks that all four consumed CRDs are established, serve v1beta1 only
(no leftover v1alpha1 or conversion webhook), and expose the WarmPool
generation field. Validation is GET-only: it does not inspect one particular
Deployment topology and does not create a temporary SandboxClaim.
API compatibility does not prove that the external controller is healthy.
Child placement requires managed mode. Reference the BootstrapConfig
published by the Helm release from the child ClusterPool. For a
release named kobe:
spec:
bootstraps:
- name: kobe-agent-sandbox-v1-0-0
Kobe checks the exact BootstrapConfig owner and pinned-manifest digest before allocating a child. After generic ClusterInstance bootstrap, Kobe authenticates the installed CRDs and controller image, then runs a restart-safe create/delete canary inside that child. Helm contains no operational canary hook.
If a cluster still runs Agent Sandbox v0.5.x, follow the upstream v1.0.0
migration: prune v1alpha1 from CRD status.storedVersions, install v1.0.0,
then delete the leftover webhook Service, cert Secret, and namespaced
Role/RoleBinding. Update operator-authored child bootstrap content at the
same time. Managed child pools must be recycled after changing the pinned
runtime; Kobe rejects mismatched children. Kobe never performs this upgrade.
Agent Sandbox does not install gVisor, Kata, node runtimes, or RuntimeClasses.
This release certifies only trusted-runc, for trusted workloads. The gvisor
and kata schema values are reserved; selecting either keeps the pool
Ready=False even when the named RuntimeClass exists. Kobe never downgrades
either tier to runc.
Example
apiVersion: kobe.kunobi.ninja/v1alpha1
kind: SandboxPool
metadata:
name: agent-small
namespace: kobe-system
spec:
warmCapacity: 2
defaultTtl: 30m
maxTtl: 2h
maxIdle: 30m # optional; see Idle reclaim below
provisioningTimeout: 10m
transport: direct # or iroh
placement:
type: management
template:
defaultContainer: workspace
containers:
- name: workspace
image: ghcr.io/example/agent-sandbox:v1
command: ["/usr/local/bin/agent"]
args: ["serve"]
resources:
requests:
cpu: 250m
memory: 512Mi
ephemeralStorage: 1Gi
limits:
cpu: "1"
memory: 2Gi
ephemeralStorage: 4Gi
exposedPorts:
- name: http
container: workspace
port: 8080
files:
- secret: pecorino-claude-oauth
key: credentials.json
path: /home/agent/.claude/.credentials.json
isolation:
tier: trusted-runc
readiness:
canary:
argv: ["/usr/local/bin/agent", "healthcheck"]
timeout: 30s
Every container must declare CPU, memory, and ephemeral-storage requests and
limits. defaultContainer and each exposed port must refer to a declared
container. Kobe runs every Sandbox container as UID/GID 65532, drops all
Linux capabilities, disables privilege escalation, and applies the
RuntimeDefault seccomp profile. Images must work as that non-root user and
must not require writable root-owned paths. Canary argv is executed
directly, without an implicit shell.
Secret files
template.files mounts Kubernetes Secrets that already exist in the Sandbox
Pod namespace into every container. Callers cannot add or override them. Every
Sandbox from the pool gets the same files; they are part of the certified
shape, not an exception to it.
The Secret is referenced by Kubernetes name. Kobe does not create it or copy
its bytes into the Pool. If the bytes come from 1Password, create the item
first and point External Secrets at the item UUID (remoteRef.key), not the
title. The Kubernetes Secret that lands in the cluster is what files.secret
names. That Secret must be in the namespace where the Pods run: the Pool
namespace for placement.type: management, or kobe-sandbox inside a child
cluster.
Each entry is one key at one absolute path, mounted read-only with subPath
so the rest of the parent directory stays writable. Mode is 0444 so UID
65532 can read the file. A missing Secret fails Pod startup, so the pool
stays uncertified.
Declare at most 16 files with distinct, absolute paths. Paths cannot contain
. or .. segments, repeated slashes, or a trailing slash. Prepare any
directories the tool needs to write in the image with ownership for UID
65532. Tools cannot rewrite these mounted credential files.
Rotating the Secret updates new Pods. Warm Sandboxes already running keep the bytes they started with until those Pods are recreated.
Workspace volume
Without a volume, everything a lease writes (the clone, build output, tool
caches) lives in the container's writable layer and counts against
limits.ephemeralStorage. When a box crosses that limit, kubelet evicts the Pod
and the whole session is lost.
template.workspaceVolume gives each Sandbox its own persistent volume, mounted
into the default container:
spec:
placement:
type: management
template:
workspaceVolume:
storageClassName: openebs-zfs
size: 200Gi
mountPath: /home/agent/work
When the volume fills up, writes fail with "No space left on device" and the
Sandbox keeps running, so you can free space and carry on. Keep repositories and
build output under mountPath to benefit; anything outside it still counts
against the ephemeral-storage limit.
- Each Sandbox gets its own claim, deleted with the Sandbox. Nothing is shared between leases, and teardown returns capacity only after the claim is gone.
- The StorageClass must use
reclaimPolicy: Delete. A pool whose class retains volumes, or names a class that does not exist, is not certified. - A node-local class with
volumeBindingMode: WaitForFirstConsumerbinds each volume where its Pod is scheduled. Warm Sandboxes create their claim up front. - The volume is only available with
managementplacement.mountPathmust be an absolute directory other than/, and must not contain or sit inside a path fromfiles. - Callers still cannot add volumes of their own.
Idle reclaim
Without maxIdle, a sandbox has a fixed lifetime from readiness: extensions cannot move expiry past readyAt + maxTtl. A box used every day and one forgotten yesterday look the same.
With maxIdle, each extension is bounded by now + maxIdle (and still by the caller's grant). A caller that keeps extending keeps the box; one that stops loses it within maxIdle of the last extension. maxExtensions does not apply while maxIdle is set, because a count cap would restore a fixed lifetime.
The AccessPolicy sandbox grant can set its own maxIdle. The effective window is the lower of the pool and the grant.
Transport
transport: direct (default) is the WebSocket path terminated at the API server. transport: iroh opts the pool into P2P QUIC for attach, exec, and port-forward. Session bytes are end-to-end encrypted; a relay sees addresses and timing, not content.
Admission rejects iroh if the operator set agentSandbox.irohRelay=disabled. It never silently falls back to direct. Relays: Helm.
Placement and isolation
Use placement.type: management to place upstream Sandbox objects in Kobe's
management cluster. To compose a Sandbox with a child cluster from a
same-namespace ClusterPool, use exactly one child placement instead:
placement:
type: childCluster
clusterPoolRef: ci-sandbox
Isolation tier trusted-runc must omit runtimeClassName. Reserved tiers
gvisor and kata require the exact administrator-selected RuntimeClass name,
but remain ineligible until their runtime and node contract is qualified.
Lease callers cannot override either placement or isolation.
See the API reference for lease operations and authentication for Sandbox policy verbs and limits.