---
title: "Enforce the restricted pod security · Agent Wranglers"
url: https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/pod-security-standards
id: INF-82
level: Required
applies: servers
risk: takeover
updated: 2026-10-27
build: a2a6bdfed830
tokens: 913
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Enforce the restricted pod security standard

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Containers and orchestration](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: INF-82
- Level: Required
- Chapter: [Containers and orchestration](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration.md)
- Rule: Label every application namespace to enforce the Kubernetes `restricted` pod security standard. Keep `privileged` only for named system namespaces.
- Check: Every namespace except the listed system ones has the label `pod-security.kubernetes.io/enforce=restricted`. A test pod that runs as root is refused in each of them.
- Risk: An account or system taken over
- Applies when: The project runs its own servers, virtual machines or containers.
- How: The restricted standard refuses pods that run as root, add capabilities, allow privilege escalation or skip the default seccomp profile. That is the Kubernetes form of [Never give a container control of the host](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/no-privileged-containers.md). The built-in pod security admission reads three labels per namespace, `enforce`, `audit` and `warn`. Turn on `warn` and `audit` first, fix what they report, then `enforce`. System add-ons that need host access, such as a network plugin, get their own namespace with a written reason.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### YAML example

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

### YAML example 2

```yaml
# A container that passes the restricted standard
securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities: { drop: [ALL] }
  seccompProfile: { type: RuntimeDefault }
```

## Sources

- [Kubernetes, Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/)
- [Kubernetes, Pod Security Admission](https://kubernetes.io/docs/concepts/security/pod-security-admission/)

## Related rules

- INF-74 [Never give a container control of the host](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/no-privileged-containers.md) in Infrastructure and environments

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/pod-security-standards">Agent Wranglers infrastructure and environments playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Deny pod traffic by default with network policies](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/kubernetes-network-policies.md)
- Next: [Deploy only signed images from tags that cannot move](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration/signed-immutable-images.md)
- [Containers and orchestration](https://agentwranglers.se/playbook/infrastructure/containers-and-orchestration.md)
