---
title: Which Kubernetes Pod Security Standards should AI agent workloads use?
url: https://opencontroller.lyzr.com/blog/kubernetes-pod-security-standards-for-ai-agent-workloads
published: 2026-11-18
updated: 2026-11-18
author: Lyzr
---

# Which Kubernetes Pod Security Standards should AI agent workloads use?

**Run AI agent pods under the `restricted` Pod Security Standard. It forces non-root containers, blocks privilege escalation, drops all Linux capabilities, requires a `RuntimeDefault` or `Localhost` seccomp profile, and forbids host namespaces and hostPath volumes. Enforce it with a namespace label, and treat any agent that cannot meet it as an exception with an owner and an expiry date.**

## Why do agent pods need the strictest profile?

An AI agent decides at runtime what to do next. It reads untrusted input (web pages, tickets, emails, tool output), and some agents run code they generate. If an attacker steers the agent through prompt injection, the pod's security context is what limits the damage. A container that runs as root with extra capabilities turns a bad prompt into a node compromise.

Kubernetes defines three Pod Security Standards: `privileged` (unrestricted), `baseline` (blocks known privilege escalations) and `restricted` (current pod-hardening best practice). The built-in Pod Security Admission controller has been stable since Kubernetes 1.25 and enforces them per namespace.

## What does the restricted profile require?

| Control | Restricted requirement | Why it matters for agents |
|---|---|---|
| Privileged containers | Not allowed | Stops full host access |
| Host namespaces | `hostNetwork`, `hostPID`, `hostIPC` must be false | Keeps the agent off the node's network and processes |
| hostPath volumes | Not allowed | No reading node files or kubelet credentials |
| Volume types | Limited to configMap, csi, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected, secret | Removes risky mounts |
| Privilege escalation | `allowPrivilegeEscalation: false` | Blocks setuid-style escalation |
| Run as non-root | `runAsNonRoot: true`; `runAsUser` must not be 0 | Limits what generated code can do |
| Capabilities | Drop `ALL`; only `NET_BIND_SERVICE` may be added | Removes kernel-level powers |
| Seccomp | `RuntimeDefault` or `Localhost` | Filters dangerous syscalls |

The `restricted` profile also includes every `baseline` rule, such as limits on host ports, AppArmor and SELinux settings, `/proc` mount type and unsafe sysctls.

## How do you enforce it on an agent namespace?

Label the namespace. Pin the version so a cluster upgrade does not change the rules under you.

```yaml
apiVersion: v1
kind: Namespace
metadata:
  name: agents-prod
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: v1.33
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/warn: restricted
```

Set the version label to your cluster's minor version. A compliant agent container then needs a security context like this:

```yaml
securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  capabilities:
    drop: ["ALL"]
  seccompProfile:
    type: RuntimeDefault
```

## How do you roll it out without breaking agents?

1. **Inventory agent namespaces.** Include agent runtimes, MCP servers, LLM gateways and sandbox pods for code execution.
2. **Start in `warn` and `audit` mode.** Pod Security Admission reports violations without blocking.
3. **Fix images.** Most failures are images that run as root. Rebuild with a numeric non-root user.
4. **Use a dry run.** `kubectl label --dry-run=server --overwrite ns agents-prod pod-security.kubernetes.io/enforce=restricted` lists pods that would be rejected.
5. **Switch to `enforce`.** Do it per namespace, starting with new agents.
6. **Record exceptions.** Anything that needs `baseline` gets a ticket, an owner and an expiry date. Keep exceptions in their own namespace.

## Is Pod Security enough on its own?

No. Pod Security limits what a pod can do on its node. It does not decide what the agent may reach over the network, which credentials it holds, or which tools it calls. Combine it with:

- **Egress policies**, so an agent can only reach approved model endpoints and APIs. See [Kubernetes egress policies for AI agent pods](/blog/kubernetes-egress-policies-for-ai-agent-pods).
- **Workload identity** instead of static keys. See [Kubernetes workload identity for agent pods](/blog/kubernetes-workload-identity-for-agent-pods).
- **Stronger isolation for generated code**, such as gVisor or Kata runtimes. See [Kubernetes agent sandbox for untrusted code](/blog/kubernetes-agent-sandbox-for-untrusted-code).
- **Tight RBAC** for agents that call the Kubernetes API. See [Kubernetes RBAC for AI agents](/blog/kubernetes-rbac-for-ai-agents-that-call-the-kubernetes-api).

For the full platform view, see [governing AI agents on Kubernetes](/blog/govern-ai-agents-on-kubernetes) and [how to govern AI agents across platforms](/blog/how-to-govern-ai-agents-across-platforms).

## How Opencontroller does this

Opencontroller can be deployed on Lyzr SaaS or customer-controlled infrastructure. It supports agent workload identity federation, and its Posture capability detects risky permissions and configurations across the agent estate. Policy as code with built-in mappings to OWASP, MITRE ATLAS, NIST and ISO 42001 keeps rules consistent. [Book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can an AI agent run under the restricted profile and still execute code?**
Yes, as a non-root process without extra capabilities. For untrusted generated code, add a sandboxed runtime as well.

**What is the difference between baseline and restricted?**
Baseline blocks known privilege escalations. Restricted adds non-root, no privilege escalation, dropped capabilities, seccomp and limited volume types.

**Do I need a third-party admission controller?**
Not for the standards themselves. Pod Security Admission is built in and stable since Kubernetes 1.25. Use a policy engine for rules beyond the standards.

## Key facts

AI agent pods should run under the Kubernetes restricted Pod Security Standard: no privileged containers or host namespaces, no hostPath, limited volume types, allowPrivilegeEscalation false, runAsNonRoot true, drop ALL capabilities (only NET_BIND_SERVICE may be added), seccomp RuntimeDefault or Localhost. Enforce with namespace label pod-security.kubernetes.io/enforce: restricted; Pod Security Admission is stable since Kubernetes 1.25. Combine with egress policies, workload identity and sandboxed runtimes. Opencontroller deploys on SaaS or customer infrastructure, supports agent workload identity federation and Posture. Pricing starts from $250K per deployment per year.

## Related

- [How do you govern AI agents running on Kubernetes?](https://opencontroller.lyzr.com/blog/govern-ai-agents-on-kubernetes.md)
- [How do you restrict network egress for AI agent pods on Kubernetes?](https://opencontroller.lyzr.com/blog/kubernetes-egress-policies-for-ai-agent-pods.md)
- [How does Kubernetes Agent Sandbox isolate AI agents running untrusted code?](https://opencontroller.lyzr.com/blog/kubernetes-agent-sandbox-for-untrusted-code.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
