OpenClaw EnterpriseDOCSGitHub

Kubernetes Compute with OpenShell service integration

OpenShell service integration keeps one Sandbox per Agent across revisions. OpenShell owns the Harness and its persistent storage. Kubernetes Compute manages the Agent Gateway, routing, Secrets and network policies in the OCE tenant namespace. The workspace node connects through the Gateway for file operations. This prototype remains subject to RFC review and cluster qualification.

Select the prototype

Start with the Kubernetes configuration and OpenShell Backend. Apply this overlay to the Installation file read by both API and worker:

yaml
drivers:  compute:    id: compute-kubernetes    configuration:      # Retain the existing Kubernetes authentication, image, network,      # resource and runtime settings.      servicePrincipalCredentials:        mode: disabled  sandbox:    id: openshell-sandbox    configuration:      # Retain the existing process and network policy.      integrationMode: service      gateway: {}      kubernetes:        sandboxDataMount:          subPath: workspace          mountPath: /sandbox/oce/workspace          readOnly: false

Keep the Sandbox and Credential Gateway members on the same Backend and set an OpenShell endpoint reachable from the OCE namespace. legacy is the default. Both modes keep the configured Compute Driver ID and use occ/kubernetes. The Compute schema rejects the removed managedOpenShell block.

Select the storage owner before deploying Agents. Preparation, activation, stop and retirement require the same storage owner that Compute saved for the revision. Restore the original Installation settings if they differ.

Use one cluster with enforcing NetworkPolicies, OpenShell-owned persistent Sandbox storage and one OCE worker replica. Configure the replica count on the deployment. Configure the OpenShell gateway's workspace mode independently. The workspace node uses the Envoy route. The Gateway admits the Envoy Pods, and activation removes obsolete direct workspace-node policies. Separate-cluster connectivity remains unqualified.

For an OpenShell-managed namespace, allow its supervisor Pods to reach both the OpenShell gateway (TCP 8080) and the Envoy HTTPS listener (default target 10443). The default OCE development policies select operator-owned namespaces. Add an ingress peer to each destination policy, scoped to the managed namespace and gateway. Keep both selectors in the same peer.

yaml
namespaceSelector:  matchLabels:    kubernetes.io/metadata.name: YOUR_MANAGED_NAMESPACE    openshell.ai/gateway-id: YOUR_OPENSHELL_GATEWAY_ID    openshell.ai/sandbox-workspace: YOUR_WORKSPACEpodSelector:  matchLabels:    openshell.ai/managed-by: openshell    openshell.ai/boundary-role: supervisor

Protected Git verifies execution ownership and readiness through OpenShell's API. The worker does not need Kubernetes Pod-read access in OpenShell-managed namespaces. OpenShell owns the workload identities and reports them through its authenticated supervisor and Provider status. See the Git execution trust boundary.

Build a Harness image containing /opt/oce/runtime/openshell-bootstrap.cjs and select it by immutable reference. See the OpenShell development and CI pin. For the prototype, verify that the OpenShell gateway enables SandboxUpdates.UpdateSandbox and that its Compute Driver applies updates to image, command, environment, labels and annotations with resource-version checks. The wire fixture's upstream commit defines the RPC. The gateway also needs StopSandbox, StartSandbox, ExposeService, AttachSandboxProvider, DetachSandboxProvider and UpdateConfig. Policy updates require workspace-admin authority. Combined Provider and policy replacement requires a gateway that validates attachments against the latest stored policy, including credential inspection rules.

Lifecycle and retained files

Managed creation sends kubernetes.agentResources in the spec.template.resources protobuf Struct and omits driver_config. New Sandboxes can run with allow_driver_config disabled. Per-Agent sizing overrides remain legacy-mode only. See resource settings for validation and defaults.

Before upgrading a service installation that stores sizing in driver_config, copy each affected Agent’s retained files outside its Sandbox while it is running. After upgrading, create replacement Agents, restore and verify their files, then delete the originals. Keep allow_driver_config enabled until all Sandboxes that use it have been retired. Redeployment stops the predecessor before checking its template. Provisioning refuses the old layout with SANDBOX_RECREATION_REQUIRED, including on resume. Deleting an Agent removes its retained storage.

Changing resource requests or limits on a retained Sandbox stops the predecessor and fails the deployment with SANDBOX_WORKLOAD_IMMUTABLE. Restore the original Installation sizing and deploy again to resume with the retained files.

The Sandbox and runtime Provider names derive from the Agent ID. Stop and revision retirement retain the Sandbox and its storage. Replacement updates runtime material, policy and workload while stopped. Each update checks the resource version and verifies the result. OCE starts the Sandbox after readback matches and reports it ready after OpenShell loads the latest policy. Final Agent deletion removes the Sandbox and runtime Provider.

A revision can replace Credential Source Providers and change network rules. OCE clears base rules before changing attachments, detaches obsolete Providers, attaches replacements, then installs the final policy. Detachment preserves shared Providers and other Agents' access. If a step fails, the Sandbox stays stopped and the next attempt reconciles stored policy and attachments. Runtime Provider updates delete obsolete keys and preserve unchanged empty fields. A changed field must have a nonempty value because OpenShell treats an empty update as deletion.

The bootstrap keeps private runtime state under /opt/oce/managed/private/home and the Node compile cache beside it on the workload filesystem. A replacement starts with a fresh home and links the workspace, generated images and Codex sessions to /sandbox/oce. OPENCLAW_NODE_STATE_DIR points directly to retained node state for atomic writes. The bootstrap refuses symlink ancestors, conflicting links and private homes left on the volume by earlier builds.

Dedicated OpenClaw uses the bootstrap to prepare its storage and can keep kubernetes.userNamespaces enabled. Every real ancestor of its node state directory must pass the worker's permissions check. Group- or world-writable ancestors require sticky protection. Before restart, OCE restores any missing startup exposure, checks its port and bearer-passthrough authorization, and withdraws it after enrollment. Codex keeps its app-server exposure.

OCE delivers initial workspace files from an Agent-owned setup Secret over authenticated ExecSandbox stdin. See the provisioning flow for ordering and failure handling.

Limits and diagnosis

Use the managed OpenShell test checklist to verify cluster permissions, networking, model execution and replacement.

Search documentation