Skip to main content

Pods Rejected After a Namespace Is Set to Enforce the Restricted Pod Security Standard

High severity Target recovery 30mKubernetes

Overview

After a Kubernetes namespace is labelled pod-security.kubernetes.io/enforce=restricted, Pod Security admission rejects new pods that fail a Restricted control, while running pods carry on. Put back the earlier enforce level with Restricted in warn and audit, find failures with kubectl label --dry-run=server, fix each pod template security context, then enforce Restricted pinned to a version.

Markdown, one checkbox per step, for pasting into a ticket.

Diagnose

Symptom

What responders observe.

Open this runbook when a namespace has recently gained or tightened its Pod Security enforce label and any of these follows:A Deployment shows fewer ready replicas than desired, and kubectl describe deployment lists a ReplicaFailure condition with reason FailedCreate.

The condition message starts Error creating: pods "<name>-" is forbidden:, followed by the reason the pod was refused.kubectl rollout status does not finish, or exits non-zero once the Deployment passes its progress deadline (ProgressDeadlineExceeded).A Job or CronJob that ran before the label change now creates no pods.The kubectl label command printed warnings about existing pods.

Adding or changing an enforce label tests every pod in the namespace and returns violations as warnings, but the label is still applied.Enforce mode checks pods, not Deployments or Jobs, so kubectl apply of a workload still succeeds and the failure shows only on the ReplicaSet or Job.

Detection

Metrics, logs and confirmation commands.

Root cause

Why the incident occurred.

Contain and prevent

Blast radius

What else this can affect.

Prevention

Controls and guardrails that stop it recurring.

  • Make the Kubernetes rollout order standard: set warn and audit to Restricted first, run the server-side dry run, let it soak long enough to cover CronJobs, then enforce.Pin enforce-version so a cluster upgrade does not change what the namespace enforces, and move the pin deliberately.Find namespaces with no enforce level at all with kubectl get namespaces --selector='!pod-security.kubernetes.io/enforce', and check every new label key and value for typos before relying on it.

  • Our note on a Pod Security label typo that lets privileged pods through shows why.Add the four security context fields to your chart and pod template defaults.

Fix

Pre-flight checks

Check these before you change anything.

  1. kubectl access with read rights on namespaces, workloads and events in the affected namespace.

  2. Permission to update namespace labels (usually a cluster administrator) for the stabilisation and re-enforcement steps.

  3. Access to the source (Git, Helm values or pipeline) the affected workloads are deployed from.

Commands in these steps

  • kubectl access with read rights on namespaces, workloads and events in the affected namespace

Commands

kubectl config current-context
kubectl auth can-i patch namespaces/<namespace>
kubectl get namespace <namespace> -o yaml > ns-before.yaml
kubectl describe deployment <name> -n <namespace>
kubectl events -n <namespace> --types=Warning
kubectl label --dry-run=server --overwrite ns <namespace> pod-security.kubernetes.io/enforce=restricted
kubectl label --overwrite ns <namespace> pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/audit=restricted pod-security.kubernetes.io/warn=restricted
kubectl rollout status deployment/<name> -n <namespace> --timeout=5m
kubectl rollout undo deployment/<name> -n <namespace>
kubectl label --overwrite ns <namespace> pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/enforce-version=v1.37

Verify and recover

Verification

Evidence required before you close the incident.

  1. kubectl label --dry-run=server --overwrite ns <namespace> pod-security.kubernetes.io/enforce=restricted — No warnings. — Every running pod meets Restricted.

  2. Reapply each CronJob and scaled-to-zero workload manifest with warn=restricted set. — No Pod Security warnings. — Pod templates that are not running also meet Restricted.

  3. After enforcing Restricted, kubectl describe deployment <name> -n <namespace> and watch the next rollout or Job run. — No ReplicaFailure condition; new pods are created. — Pod creation works under enforce=restricted.

Commands in these steps

  • kubectl label --dry-run=server --overwrite ns <namespace> pod-security.kubernetes.io/enforce=restricted — No warnings. — Every running pod meets Restricted

Rollback

The safe way back.

  1. Namespace: kubectl label --overwrite ns <namespace> pod-security.kubernetes.io/enforce=<earlier level>, or reapply the labels saved in ns-before.yaml.

  2. If the namespace had no enforce label before: kubectl label ns <namespace> pod-security.kubernetes.io/enforce- Workload: kubectl rollout undo deployment/<name> -n <namespace> and revert the commit in source control.

Escalate when

Conditions that need another owner.

  • A workload fails Baseline as well (host network, hostPath, privileged containers).

  • Running it is a security decision, not a fix.

  • Move it to a separate namespace with a reviewed level, decided with the security team.The application team cannot run the image as non-root.

  • Escalate to the image owner, and keep the namespace at its earlier enforce level until the image is rebuilt.Anyone proposes an exemption or the Privileged level to end the incident.The label was applied to every namespace with --all, or production replicas are still falling 30 minutes after stabilisation.

  • Security team and platform owner Image or application owner Platform owner.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

Sources

Based on the vendor sources listed below. Check each step against your environment before acting.

First published 19 November 2026

Publisher: Kubernetes documentationkubernetes.io

Pod Security Admission

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Pod Security Standards

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Enforce Pod Security Standards with Namespace Labels

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Deployments

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Pod (Kubernetes API reference)

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

Configure a Security Context for a Pod or Container

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl label

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl events

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl get

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl auth can-i

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl config current-context

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: Kubernetes documentationkubernetes.io

kubectl rollout status

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Publisher: NISTcsrc.nist.gov

Incident Response Recommendations and Considerations for Cybersecurity Risk Management (SP 800-61r3)

Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.

Share