Repository navigation
Description
Summary
A namespace gets the Pod Security Admission (PSA) enforce: restricted label as part of a security-hardening rollout. Nothing breaks immediately — PSA only gates admission, so already-running pods keep running. But the moment a pod is deleted (node drain, eviction, rollout, crash), the ReplicaSet's recreate attempt is rejected by the kube-apiserver itself with violates PodSecurity "restricted:latest", because the app's pods run as root / don't set a seccomp profile / don't drop capabilities. The deployment quietly goes under-replicated, and stays that way.
The trap: there is no webhook to find, no crash loop, no resource pressure, and no image problem. The Deployment spec, Service, and resources are all valid. The rejection happens at the namespace policy layer — a label on the Namespace object — which most diagnostic flows never inspect. The error only surfaces in ReplicaSet events, not in Deployment or Pod status.
Real-World Failure Story
Pod Security Admission replaced the deprecated PodSecurityPolicy and went GA in Kubernetes 1.25. The Pod Security Standards define three profiles (privileged, baseline, restricted); the restricted profile is the strictest and requires pods to explicitly set runAsNonRoot: true, drop all capabilities, and set a seccompProfile, among others.
The classic incident pattern is well documented as a failure class (rather than a single named company postmortem):
- A platform team enables
enforce: restrictedon a namespace to satisfy a compliance requirement. - Existing workloads were built before these constraints — they run as root, omit a seccomp profile, or request added capabilities. They violate
restrictedbut were never rejected, because PSA only checks pods at admission time, not pods already running. - The violation stays dormant until something forces a pod to be recreated — a node drain, an autoscaler scale-up, a rollout, or a crash. Then the new pod is denied and the service silently degrades.
- A particularly subtle variant: an injected sidecar (service mesh, logging agent) adds a
securityContextthat violates the policy, so even a "compliant" app deployment fails admission once the sidecar is merged in.
This is documented across vendor and community guidance as a real operational footgun, with dedicated incident-response runbooks:
- Kubernetes — Pod Security Admission (enforce/audit/warn modes; enforce rejects violating pods at admission).
- OneUptime — Troubleshooting PSA rejections after migration ("a critical service fails to roll out after a policy change because production pods were denied").
- The standard prevention advice — never go straight to
enforce: restricted; stage withaudit/warnfirst — exists precisely because teams keep hitting this.
Honesty note for reviewers: unlike the webhook-timeout RFC (which maps to a specific filed incident, kubernetes/kubernetes#128162), this is grounded in a documented failure class with published runbooks rather than a single named company RCA. The mechanism, symptoms, and fix are all real and reproducible; the "famous postmortem" is what's missing.
Why this is a distinct failure class from the admission problems already in SREGym:
admission_webhook_outage,admission_webhook_tls_mismatch,mutating_webhook_resource_limitsare all webhook problems — the agent's diagnostic path is "enumerate webhook configs, find the broken/Fail one."- PSA is built into the kube-apiserver — there is no
ValidatingWebhookConfigurationorMutatingWebhookConfigurationto find. The policy lives as a label on the Namespace. Enumerating webhooks returns nothing; the agent has to look at namespace metadata, a genuinely different place. No existing problem touches PSA or the Pod Security Standards.
Proposed Simulation
Target application: Hotel Reservation (same single-namespace scoping as the existing admission problems; target a single-replica deployment such as recommendation).
Fault injection:
- Add the PSA enforce label to the app namespace:
pod-security.kubernetes.io/enforce: restricted(optionally pinenforce-version). - Confirm the target deployment's pods violate
restricted(the demo images run as root / lackrunAsNonRoot/ lack a seccomp profile — true for the Hotel Reservation services). - Delete one pod of the target deployment. The ReplicaSet's recreate attempt is rejected at admission; the deployment stays under-replicated.
(Existing running pods of other services are unaffected — PSA doesn't evict them — which reinforces the "everything looks fine except this one deployment" symptom.)
Expected symptoms:
- The target deployment is under-replicated; the missing pod is never created.
- ReplicaSet events show
Error creating: pods "<name>" is forbidden: violates PodSecurity "restricted:latest": <specific violations>(e.g.allowPrivilegeEscalation != false,runAsNonRoot != true,seccompProfile). - No webhook configurations exist to explain it — enumerating
Validating/MutatingWebhookConfigurationreturns nothing relevant. - Deployment spec, image, Service, and resources are all valid.
Compatibility: Works on kind — PSA is a built-in admission plugin enabled by default since 1.25 (kind runs ≥1.25). Pure Kubernetes machinery, no host access, no control-plane saturation. Deterministic: the label either is or isn't present, and the violation is structural.
Expected Mitigation
Any of:
- Remove the
pod-security.kubernetes.io/enforce: restrictedlabel from the namespace (revert the hardening). - Relax it to a profile the workload satisfies (e.g.
baseline), or setenforce: privilegedfor that namespace. - (Hardest / most production-correct) Make the workload compliant — add
securityContextwithrunAsNonRoot,allowPrivilegeEscalation: false, dropped capabilities, and aseccompProfile— so it passesrestricted.
Once admission stops rejecting the pod, the existing ReplicaSet recreates it with no further changes. The lesson: PSA enforcement is silent until a pod is recreated, and restricted rejects workloads that were never built for it.
Oracle Design
Diagnosis oracle: LLMAsAJudgeOracle — validates the agent identified the namespace PSA restricted enforcement (not a webhook, not the app) as the root cause.
Mitigation oracle: DeploymentReadinessOracle — passes only when the target deployment's ready_replicas == desired and all its pods are Running/Ready. This is the same oracle the existing webhook-outage problem uses: it reports failure while admission is blocked (the recreated pod is absent) and success once the workload can be admitted again. It accepts all three mitigation paths and resists reward-hacking (deleting the deployment / scaling to zero leaves it not-ready).
Implementation Notes
- Follows the
admission_webhook_outage.pylifecycle: ininject_fault()apply the namespace label and delete one target pod to surface the blocked recreate; inrecover_fault()remove the label. - Apply the label via
client.CoreV1Api().patch_namespace(...)(orkubectl label namespace ...), capturing any prior PSA labels so recovery restores the exact original state. - Reuse the existing
DeploymentReadinessOracleandLLMAsAJudgeOracle— no new oracle needed. - Files:
sregym/conductor/problems/psa_restricted_blocks_recreation.py(new), one import + one registry entry insregym/conductor/problems/registry.py. - Verify on kind that the target Hotel Reservation deployment's pods actually violate
restrictedbefore wiring the oracle (they should, since the images run as root without a seccomp profile). If any chosen service happens to already be compliant, pick one that isn't.
Activity
Saadmrp1038 commentedon Jun 13, 2026
@TamimEhsan Thanks for the RFC!
Looks good to me. Although you might need to do some actual agent runs to see how the diagnosis and mitigation rates look for this. Ideally, the agent should not always manage to solve this. Otherwise, this might be too easy for the benchmark.