# How to sandbox AI agents on Kubernetes

DevFeed: [How to sandbox AI agents on Kubernetes](<https://devfeed.tech/articles/how-to-sandbox-ai-agents-on-kubernetes-121570.md>)

Original publisher: [Read original article](<https://nirmata.com/2026/11/05/how-to-sandbox-ai-agents-on-kubernetes/>)

Author: Ritesh Patel

Published: 2026-11-05T07:00:00Z

Content type: tutorial

Language: en

Sources: [Nirmata](<https://devfeed.tech/sources/nirmata.md>)

Topics: [AI Sandbox](<https://devfeed.tech/topics/ai-sandbox.md>), [Kyverno](<https://devfeed.tech/topics/kyverno.md>), [OpenShell](<https://devfeed.tech/topics/openshell.md>)

Tags: [agent-sandbox](<https://devfeed.tech/tags/agent-sandbox.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-agent-governance](<https://devfeed.tech/tags/ai-agent-governance.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [capabilities](<https://devfeed.tech/tags/capabilities.md>), [containers](<https://devfeed.tech/tags/containers.md>), [crd](<https://devfeed.tech/tags/crd.md>), [egress](<https://devfeed.tech/tags/egress.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [kubernetes-security](<https://devfeed.tech/tags/kubernetes-security.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [pod](<https://devfeed.tech/tags/pod.md>), [run](<https://devfeed.tech/tags/run.md>), [sandbox](<https://devfeed.tech/tags/sandbox.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

Agent Sandbox manages a stateful Pod's lifecycle but does not provide isolation itself. For unreviewed agent code, the guide combines a restricted Pod security context, disabled service account token mounting, resource limits, default-deny egress, and a RuntimeClass backed by a secure runtime such as gVisor or Kata Containers. Apply namespace security labels and network policy before creating the first sandbox; default-deny also blocks DNS, so allow DNS and only required destinations. The runtime handler must exist on eligible nodes or the Pod fails. RBAC should limit who can create sandbox resources, while admission policies check Pod settings; admission cannot observe runtime behavior. NetworkPolicy enforcement depends on the cluster networking plugin, and the supplied Kyverno example runs in Audit mode, reporting rather than blocking violations.

## Source excerpt

Run each AI agent in its own Pod with a hardened security context, default-deny egress and a RuntimeClass, with lifecycle managed by Agent Sandbox CRD.