Skip to navigation

Claude Code Pod Security: Admission Gate Reviews

In short: Use Pod Security Standards and admission checks to review agent-authored workloads without treating policy as runtime proof.

Published 21 min read
On this page

Direct answer

Pod Security Admission is a built-in Kubernetes admission controller that validates a new or updated pod against one of three Pod Security Standards profiles and rejects it when the spec breaks the rules. It is a change gate at the API server, not a runtime guard. When Claude Code proposes a workload manifest, admission tells you whether the pod definition violates the assigned profile before the scheduler accepts it. It does not tell you whether the running container is safe, whether the image has known vulnerabilities, or whether a sidecar the agent added can reach a database. Treat an admission result as one line in the change packet, next to a human review of what the workload is allowed to touch.

The concrete win is catching privilege escalations at apply time, before a pod with a hostPath mount or a privileged container lands in a namespace that should never host one. The concrete loss is the false comfort that a passing admission check means a secure workload, which it does not. The practical implication is that the reviewer’s job splits in two: confirm the pod definition clears admission, then separately review what the running workload can do.

Why an agent-authored pod deserves its own gate

Claude Code generates manifests fast. A request like “add a sidecar that tails the app log and ships it to our collector” produces a pod spec with volumes, security contexts and service account references in seconds. The speed is useful and it is also where the risk sits. A human writing the same manifest usually copies a known-good template. An agent assembling a spec from context can combine fields in ways nobody on the team has run before.

OWASP’s guidance on secure coding with AI tools treats agent output as untrusted input and recommends least privilege plus human review, which is exactly the posture Pod Security Admission supports. The controller enforces a floor the whole namespace shares, so one careless manifest cannot quietly opt a workload into privileged: true. The floor is real and it is narrow.

Two failure modes show up in practice. The first is a rejected deploy during a rollout, discovered only when the manifest hits the cluster and admission returns an error. The second is a workload that passes admission and then does something the profile never constrained, such as talking to a metadata endpoint or reading a mounted secret it did not need. The first gets caught at the gate. The second has nothing to say about it.

Evidence and its limits

Official, F019: The Pod Security Standards page defines three cumulative profiles, Privileged, Baseline and Restricted. Cumulative means each profile includes the restrictions of the one before it. Profile selection is a workload and risk decision, not a universal default, so a cluster can and should run different profiles in different namespaces.

Official, F020: The same page describes Baseline as preventing known privilege escalations while allowing common default pod configurations. Baseline is not the most restrictive profile, and it does not cover every runtime risk a workload can carry.

Official: The Pod Security Admission documentation describes how the built-in controller enforces the standards at the API server. That page was not fetched in full during the research pass behind this post, so version-specific configuration fields should be rechecked against current Kubernetes documentation before relying on a fine detail.

Official: The dynamic admission control reference covers webhooks and how they differ from built-in admission. Teams that need custom checks beyond the standards usually add a validating webhook, which brings its own availability and latency considerations.

Official: The RBAC reference matters because admission and authorization are separate layers. A pod that passes admission can still be blocked by RBAC, and a service account with broad RBAC can make an otherwise well-confined pod dangerous. The additive nature of RBAC permissions is covered in the Kubernetes RBAC least privilege guide.

Independent: OWASP Secure Coding with AI recommends treating agent-produced infrastructure code as untrusted and reviewing it before it reaches production systems.

Derived, F021: Treating Pod Security Admission as a change gate rather than proof of runtime security is an operational interpretation built on the official standards documentation. The standards page does not certify a cluster or a workload, and this post does not claim any admission outcome proves a pod is secure.

No runtime security measurement, exploit demonstration or pod rejection rate is reported here. Nothing in this post was measured on a live cluster.

Pod Security Standards overview

The three profiles form a ladder. Each one adds restrictions on top of the previous profile, so a workload that satisfies Restricted also satisfies Baseline and Privileged.

Profile Restriction level Suitable workload class
Privileged None beyond what the API server already requires System components, CNI and CSI drivers, operators that need host access
Baseline Blocks known privilege escalation vectors, allows most defaults General application workloads, internal services, batch jobs
Restricted Heavily limits host interaction, requires hardened security contexts Untrusted user input, multi-tenant platforms, workloads handling sensitive data

Reading the table as a decision tree, most product teams run their application namespaces at Baseline and reserve Restricted for namespaces that take untrusted input or share a cluster with other tenants. Platform and infrastructure namespaces often need Privileged because node-level components genuinely require host access.

A profile is a floor for the namespace, not a ceiling for the workload. A team can run at Restricted and still add their own NetworkPolicy, seccomp profile and read-only root filesystem on top. The NetworkPolicy blast radius guide covers the traffic side of that layering.

Choosing a profile for a namespace

Profile choice is a per-namespace decision driven by what runs there and who can create workloads. Three questions settle most cases.

What is the workload’s trust boundary? A namespace that only runs first-party services behind an ingress has a different answer than a namespace that runs user-submitted code.

What does the workload genuinely need from the host? A DaemonSet that reads node logs needs capabilities that Restricted forbids. Pushing it to Restricted breaks the workload, and the fix is either a different namespace or a documented exemption.

Who can create pods in the namespace? A namespace where only the platform team has create rights can afford a stricter profile than one where a CI pipeline or an agent identity can apply manifests directly.

The profile that fits a given namespace is a platform decision, not something Claude Code should pick on its own. Ask the agent to propose a manifest that satisfies the namespace’s assigned profile and to report which security context fields it set, rather than asking it to choose the profile.

Evidence map showing that Pod Security Admission validates a pod definition at the API server but does not prove the running workload is secure.
Editorial evidence map based on F019 and F021. Admission can reject a risky pod definition, but it does not prove the running workload is secure. Labels are the post author’s.

Namespace configuration

Pod Security Admission reads its configuration from namespace labels. The two labels that matter are one that names the enforcement level and one that names the version to pin. Enforcing a profile means pods that violate it are rejected. The controller also supports audit and warn modes, which record or surface violations without rejecting the pod, and those modes are the standard way to test a profile change before enforcing it.

A namespace configuration looks conceptually like this.

bash
apiVersion: v1
kind: Namespace
metadata:
name: payments
labels:
  pod-security.kubernetes.io/enforce: restricted
  pod-security.kubernetes.io/enforce-version: latest
  pod-security.kubernetes.io/audit: restricted
  pod-security.kubernetes.io/warn: restricted

The pattern worth copying is enforcing one level while auditing the profile above it. A namespace enforcing Baseline can audit Restricted, which shows which workloads would break if the team tightened the floor later. Running audit alongside enforce turns a future profile bump from a surprise into a planned migration.

Claude Code’s role here is to generate the manifest and to check it against the namespace’s current labels. Ask the agent to run kubectl get namespace payments --show-labels and report what is enforced before it proposes a workload, so the manifest matches reality rather than an assumed profile.

Namespace Assigned standard Exemption owner Review date
payments Restricted platform-oncall 2027-02
web Baseline web-team lead 2027-01
logging-daemons Privileged infrastructure lead 2027-03
sandbox-dev Baseline developer-experience 2027-01

The review date column is the part most teams skip. A profile assigned during setup and never revisited drifts from what the namespace actually runs, which is the same staleness problem the runbook ownership guide describes for operational documentation.

Exemption review

Exemptions exist because some workloads legitimately need something a profile forbids. A node problem detector might need host PID access. A legacy service might not be ready for a read-only root filesystem. The controller supports exempting specific users, service accounts or namespaces from enforcement, which is the mechanism that keeps a platform from breaking itself.

An exemption weakens the namespace floor, and it deserves the same treatment as any other security exception: a named owner, a reason, a compensating control and an expiry. The security exception expiry guide covers the register design in detail. The short version is that an exemption with no owner and no review date is just an undocumented weakening of the control.

The scope of an exemption matters as much as its existence. Exempting a whole namespace from Baseline because one legacy job needs a hostPath mount removes the floor for every pod that lands there afterward, including ones Claude Code creates next week. Exempting a specific service account narrows the gap considerably. When the agent proposes a manifest that needs an exemption, the reviewer should check whether the exemption is scoped to a service account rather than to the namespace.

Admission result Runtime control gap Required follow-up
Pod accepted at Restricted Image content, runtime behavior and network reachability unverified Scan the image and review egress rules
Pod accepted at Baseline Runtime privilege and syscall surface not constrained Add seccomp and capability reviews
Pod accepted with exemption Exemption scope may exceed what the workload needs Confirm service account scope and expiry
Pod rejected by admission None, the change did not land Fix the manifest, then re-review

Agent workload checks

Reviewing a Claude Code pod proposal is a specific checklist, not a general “does this look right” pass. The reviewer’s questions depend on what the profile already constrains and what it leaves open.

At Restricted, most of the container security context is already forced, so the reviewer’s attention goes to the fields the profile does not control: which service account the pod uses, what volumes it mounts, what network it can reach, and whether the image digest was pinned. At Baseline, the reviewer also checks the fields the profile allows but a hardened workload would still restrict, such as whether the container runs as a specific non-root UID.

Check Pass condition If it fails
Profile match Manifest satisfies the namespace’s enforced profile Ask the agent to adjust the security context
Service account Named account with least-privilege RBAC Review bindings before merge
Volumes Only the mounts the workload needs Remove broad hostPath or secret mounts
Image reference Pinned digest, not a floating tag Pin the digest
Network reachability Egress intent documented Add or review a NetworkPolicy
Admission dry run A dry-run apply reports acceptance Fix the manifest before merge

The dry-run check is the closest thing to testing admission before the change lands. kubectl apply --dry-run=server sends the manifest through the API server’s admission chain without persisting it, which is exactly the evidence a reviewer wants in the change packet. A --dry-run=client check only validates the manifest locally and will not exercise admission at all.

bash
kubectl auth can-i --list --as=system:serviceaccount:payments:payments-agent -n payments
# list what the agent identity may actually do before trusting its proposal
kubectl apply --dry-run=server -f proposed-pod.yaml -n payments

The first command answers a question admission cannot: what the identity applying the manifest is allowed to do. The second answers whether admission will accept the manifest. Both belong in the review.

Admission versus runtime controls

The distinction this post keeps returning to is the one between a change gate and a runtime control. The admission layer runs once, at the API server, when the pod is created or updated. It inspects the spec and returns a decision. After that, the pod runs under whatever the container runtime, kernel, CNI and node security configuration allow.

Runtime controls are the things that constrain a running container. Seccomp profiles limit syscalls. AppArmor and SELinux confine what the process can touch. Network policies decide what the pod can reach. Read-only root filesystems limit writes. Image scanning catches known vulnerabilities before deployment and sometimes after. None of these are Pod Security Admission, and Pod Security Admission is none of them.

A team that relies on admission alone has a floor for pod definitions and nothing beneath it. A team that layers admission with runtime controls has defense at two different moments in the workload’s life. The practical consequence for agent-authored workloads is that a manifest clearing admission is the beginning of the review, not the end of it.

Workflow from agent-proposed manifest through namespace profile check, server-side dry run, human review of service account and volumes, admission decision, then separate runtime control review.
Editorial workflow based on F019 and F021. Admission is one step in a review sequence, not the whole review.

Change evidence

The change packet for an agent-authored pod should contain five artifacts. Each one answers a specific question an auditor or a future reviewer will ask.

Artifact Question it answers Owner
The proposed manifest What exactly would run Change requester
Server-side dry-run output Did admission accept it Change requester
Namespace profile labels Which floor applied Platform team
RBAC bindings for the service account What the pod can do in the API Platform team
Runtime control notes What constrains the running container Workload owner

Claude Code can produce the first four as text. It cannot produce the fifth, because runtime behavior is a property of the running cluster, not of the manifest. The reviewer who attaches only admission output and calls the change reviewed has skipped the part that admission cannot see.

This is the same evidence discipline the SOC 2 change evidence guide describes for infrastructure changes generally. A packet organized around who requested, reviewed, approved and verified the change is useful regardless of the compliance framework, and the pod security case is one instance of it. Ownership for the approval step is a RACI question, covered by the RACI for infrastructure changes guide.

Handling legacy workloads

Most clusters have namespaces that predate Pod Security Admission. The workloads there were written against whatever the API allowed at the time, and pointing a Restricted profile at them will break them. The migration path is the audit and warn modes, used deliberately.

Start by labeling the namespace with audit and warn at the target profile while leaving enforce off or at a lower level. The audit mode records violations in the API server audit log, and warn surfaces them to the client that created the pod. Both produce a list of which workloads violate the target profile without breaking anything. That list is the migration backlog.

Work through the backlog by fixing manifests or by moving the workload to a namespace whose profile already fits it. Some workloads will need an exemption with an owner and an expiry, and that is acceptable when the exemption is scoped and reviewed. What does not work is leaving a namespace at Privileged indefinitely because tightening it is inconvenient.

Claude Code can help with the migration by producing a per-workload violation report from kubectl get pod -A -o json and comparing each pod’s security context against the target profile’s requirements. Reviewing that report is still a human job, because deciding whether a violating workload should be fixed or exempted is a risk decision. If the namespace is under a freeze, the change freeze and emergency change guide covers the emergency route that applies.

Tradeoff between enforcing a strict Pod Security profile that blocks risky agent manifests and the migration cost of legacy workloads that violate it.
Editorial tradeoff diagram based on F019 and F020. A stricter profile catches more at admission; the trade is the migration work for workloads that predate it.

The concrete win, loss and implication

The concrete win is a platform floor that no single manifest can silently bypass. Once a namespace enforces Baseline or Restricted, a Claude Code proposal that sets privileged: true or mounts a sensitive host path is rejected at the API server, and the rejection is visible in the change packet as a server-side dry-run result. The rejection happens before the pod exists, which is cheaper than discovering it after an incident.

The concrete loss is the gap between a passing admission check and a secure workload. The gate inspects the spec. It does not scan the image, constrain the running process, limit network reachability or verify that the service account’s RBAC bindings are appropriate. A team that treats admission as a security certification will under-invest in the runtime controls that actually constrain a compromised container.

The practical implication is that agent-authored workloads need two review passes, and Claude Code can only help with one. The agent can generate the manifest, run the dry run and report the RBAC bindings. Deciding whether the workload should run in this namespace, with this service account, with this network access is a platform and risk decision that belongs to a human reviewer.

Checklist before approving an agent pod proposal

Check Pass condition If it fails
Namespace profile known Enforced level and version recorded Run kubectl get ns --show-labels
Dry run against the cluster Server-side dry run reports acceptance Fix the manifest
Profile genuinely fits Workload class matches the profile’s intended use Move to a namespace with the right profile
Service account least privilege Bindings grant only what the workload needs Narrow the Role or use a different account
Volumes and mounts No unexplained hostPath or secret mounts Remove them or justify with an exemption
Exemption scoped and dated Named owner, reason, expiry on file Do not approve an open-ended exemption
Runtime controls separate Seccomp, NetworkPolicy and image scan status noted Add the missing control or record the gap
Control checklist covering namespace profile confirmation, server-side dry run, service account scope, volume review, exemption expiry and separate runtime control verification.
Editorial control checklist derived from F019 and F021. Passing it shows the pod definition was reviewed honestly; it does not certify the running workload.

Pod security is one admission layer among several this batch covers. On field ownership at the API server, the Kubernetes server-side apply ownership guide covers which controller owns which field before Claude Code applies a change, which matters when admission and a webhook both touch the same object. On the identity side, the Kubernetes RBAC least privilege guide covers reviewing the union of permissions an agent identity holds.

The cloud identity side of that boundary is covered by the cloud IAM permission boundary guide, and rolling out cloud policy checks is covered by the policy as code audit-before-deny guide. Pod admission exemptions that cannot be avoided should live in the register described by the security exception expiry guide.

Governance around the gate

The admission layer is a technical control, and it sits inside a governance process that decides which profiles apply where and who owns exceptions. Three posts in this batch cover the surrounding structure. The platform governance council charter guide covers the council that owns standards and risk acceptance. The risk tiered infrastructure approvals guide covers classifying a change by blast radius before deciding who approves it. The agent identity access review guide covers the recertification cadence for the service accounts an agent identity uses.

A team that skips the governance layer ends up with a gate nobody owns. The profile assigned to a namespace is a standard, and standards need an owner who revisits them. The council model is one way to make that ownership explicit without turning every workload change into a committee decision.

Working with Claude Code on pod security

Give the agent three inputs: the namespace and its enforced profile, the manifest to review or produce, and the definition of done. Ask for a server-side dry run and a kubectl auth can-i --list against the proposed service account. Ask it to report which security context fields it set rather than a summary judgment about whether the pod is secure.

Reviewing the agent’s proposal is the reviewer’s job. The agent can read labels and run read-only commands, but deciding whether a workload belongs in a namespace at a given profile is a platform decision. The Claude Code verification guide covers the review questions: what changed, what proves it, and what was not checked. Where the agent’s confidence outruns the evidence, the false success guide covers why a passing dry run is not the same as a verified workload.

Verdict that Pod Security Admission is a change gate for agent-authored pod definitions, and runtime controls must be reviewed separately.
Editorial verdict based on F019 and F021. Use admission as the first gate in a review sequence, not as the whole security posture for a workload.

Data gap and future update

The Pod Security Admission documentation page was not fetched in full during the research pass behind this post. Version-specific label values, the exact behavior of the warn and audit modes on a given Kubernetes release, and the interaction between PSA and any validating webhook in the same admission chain should be rechecked against current upstream documentation before relying on a fine detail. The three profiles and their cumulative structure in F019 are documented on the standards page and are the stable part of this post.

No rejection rate, exploit demonstration or runtime containment measurement is reported here. A future update quantifying how often agent-authored manifests violate a Restricted profile on a real cluster would need a measurement pass across actual deployment history. No such data was collected.

Third-party admission webhooks and policy engines are out of scope. Whether a team’s validating webhook enforces stricter rules than PSA, and how the two interact, is a property of that cluster’s configuration.

One AI API Key option for OpenAI-format agents

Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.

OpenAI-format agents have a separate route: One AI API Key offers https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. It is a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility notes before choosing an agent route, or read the quickstart for the request shape.

FAQ

Does Pod Security Admission scan container images?

No. Admission inspects the pod spec at the API server and returns a decision, and it does not reach image content. Image content, including known vulnerabilities, is a separate concern handled by a scanner in the build or deployment pipeline. A pod that passes admission can still run an image with a critical CVE.

Can Claude Code choose the profile for a namespace?

It can propose one, and a human should decide. Profile selection is a platform and risk decision tied to what runs in the namespace and who can create workloads there. The agent’s useful contribution is checking whether a proposed manifest satisfies the profile already assigned to the namespace.

What is the difference between enforce, audit and warn?

Enforce rejects pods that violate the assigned profile. Audit records the violation without rejecting. Warn surfaces the violation to the client without rejecting. Audit and warn are the standard tools for testing a profile change before enforcing it.

Does a passing admission check mean the workload is safe?

No. The admission result validates the pod definition against the profile. Runtime behavior, network reachability, service account permissions and image content all require separate controls and separate review.

How do exemptions interact with namespace scope?

An exemption can be scoped to a user, a service account or a namespace. Namespace-wide exemptions remove the floor for every pod that lands there. Service account exemptions are narrower and are the preferred form when only one workload needs the exception.

More from this batch

More Claude Code troubleshooting

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →