An agent can run in a Kubernetes Pod and still have far too much authority. A mounted credential, a reachable management API, or a powerful tool can cross the boundary you thought the container provided.

We’ll design a small containment experiment first. The useful result is evidence about what the workload can and cannot do, before it receives real operational tools.

Start with the authority, not the image

List what the workload can read, change, and contact. Include mounted files, API credentials, tool permissions, outbound connections, and the people allowed to submit work.

OpenClaw’s security guidance assumes a trusted operator boundary; it is not a general hostile multi-tenant isolation service. Separate the gateway’s trust model from the infrastructure controls around it.

The diagram places a check between a proposed operation and its execution. That check must exist in the tool or execution system, independently of what the model says it intends to do.

Put the boundary around the toolConstrain what the agent’s tools and workload can do. A policy described in a prompt is not a substitute for an enforced execution boundary. Put the boundary around the tool FOLLOW THE ARROWSAgentProposes an operationTool boundaryChecks permitted scopeWorkloadExecutes within limitsEvidenceRecord and verify result
Constrain what the agent’s tools and workload can do. A policy described in a prompt is not a substitute for an enforced execution boundary.
View full-size diagram (opens in a new tab)

Work through one harmless task

Suppose the agent’s only job is summarizing three synthetic log files. It needs read access to those files and perhaps a model API. It doesn’t need your cluster administrator credential, a host filesystem mount, or a container runtime socket.

Write an authority table before deployment:

Capability Needed for this task? How to test
Read synthetic logs Yes Summary cites a known test marker
Modify input logs No Attempted write fails
Call an approved model endpoint If used Bounded test request succeeds
Read cluster Secrets No No credential grant; attempted API access denied
Run arbitrary host commands No No host execution tool or mount provided

These are test requirements, not claims that a namespace enforces them automatically.

Pause and predict

The agent's prompt says it must never read Secrets, but its service account can list them. Where is the effective boundary?

Need a hint?

What does the API server enforce when a request arrives?

Show the reasoning
The credential’s permissions permit the action. The prompt has not removed that authority. Remove the unnecessary grant and test the denial independently from the model’s response.

Translate requirements into a Pod design

For an image that supports these settings, the following is a partial Pod specification, not a complete deployable application:

spec:
  automountServiceAccountToken: false
  securityContext:
    runAsNonRoot: true
    seccompProfile:
      type: RuntimeDefault
  containers:
    - name: agent
      # Supply a verified, pinned image and its documented command.
      securityContext:
        allowPrivilegeEscalation: false
        readOnlyRootFilesystem: true
        capabilities:
          drop: [ALL]

Turning off token automount avoids supplying a default Kubernetes credential to a task that doesn’t need one. Container security settings narrow specific operations; see the security-context reference.

Determine the image’s required user ID and writable paths from the release you select. Provide explicit writable volumes only where needed. A read-only root filesystem that prevents startup is a compatibility finding to investigate, not a reason to grant unrestricted host access.

Use the release’s installation documentation for its actual image, ports, state paths, and startup behavior. The previous article’s guessed image and dashboard details have been removed.

Test network authority separately

Start with no application connectivity, then introduce only the paths the experiment requires. Use the NetworkPolicy lesson to prove enforcement before adapting it.

Allowing all public IPv4 addresses on port 443 is not an allowlist of one model provider. It may allow many destinations, and it says nothing by itself about IPv6 or other reachable address spaces. A namespace is not a guarantee against reaching internal services.

For domain-based restrictions, choose an enforcement mechanism that supports that requirement and verify its resolution and proxy behavior. Don’t pretend that a domain name is a stable CIDR block.

Keep the agent sandbox and the Pod distinct

OpenClaw’s tool sandbox has its own execution policy. Running the gateway in a container doesn’t automatically establish that policy. Its sandbox documentation distinguishes tool execution from the gateway process and documents escape hatches such as elevated execution.

Record which process actually runs a tool and which credentials it inherits. An audit command can identify some configuration problems, but its success isn’t proof that every boundary you need has been tested.

Try a containment failure

Apply the idea

The Pod cannot write its root filesystem, but a mounted workspace is writable. Can the agent change files in that workspace?

Need a hint?

The mount has its own access properties.

Show the reasoning
Yes, if its process permissions and tool policy allow it. A read-only root filesystem does not make every mounted volume read-only. Mount the synthetic input as read-only and use a separate bounded output location if the task requires writes.

Before adding a real tool, repeat the authority table with synthetic inputs, test rejection as well as success, and verify that you can remove the workload and revoke its credentials. The next step is binding approval to a specific proposed change (lesson in preparation).