A Namespace Label Typo That Lets Pod Security Admission Silently Allow Privileged Pods
Overview
A misspelled Pod Security Admission enforce label key passes kubectl apply but the intended level is never enforced. Invalid level values are rejected by PSA, so it is the typo in the key, not the value, that fails open.
At a glance
- Symptom
- A namespace intended to enforce the restricted Pod Security Standard accepts a pod manifest requesting privileged: true and hostPath mounts without any admission rejection.
- Likely cause
- Pod Security Admission is a built-in admission webhook that reads specific well-known label keys on the Namespace object at request time.
- Impact
- Any workload deployed into the affected namespace can request privileged containers, hostPath volumes, host networking or hostPID/hostIPC without admission-time rejection, which materially increases the blast radius of a…
- Verification signal
- Validation succeeds only when a server-side dry run of a manifest that violates the intended Pod Security Standard is rejected with an explicit PSA violation message referencing the…
- Safe correction
- Correct the namespace label to the exact recognised key and one of the three exact recognised values, then re-verify enforcement with a server-side dry run before relying on…
- Rollback or recovery
- If the corrected label unexpectedly blocks a workload that must continue running while the workload itself is remediated, do not disable Pod Security Admission cluster-wide.
Symptom
A namespace intended to enforce the restricted Pod Security Standard accepts a pod manifest requesting privileged: true and hostPath mounts without any admission rejection. kubectl apply returns success, the pod reaches Running, and no warning or audit annotation appears. The team believes Pod Security Admission (PSA) is active because the namespace YAML clearly lists the enforce label alongside other labels, and a similar namespace in the same cluster does correctly block privileged pods.
The immediate observation is narrow: enforcement is present for other namespaces and absent for this one, with no error surfaced at apply time.
False Assumption
The operator assumes that any namespace containing a pod-security.kubernetes.io/enforce key in its labels is protected, and that a successful kubectl apply -f namespace.yaml proves the label was accepted and understood by the API server.
Kubernetes label keys and values are opaque strings to the object store; the admission controller only matches the exact key pod-security.kubernetes.io/enforce and only recognises exact values privileged, baseline or restricted.
A namespace apply succeeds if the key is misspelled (for example pod-security.kubernetes.io/enforced), because label validation only checks that keys conform to generic Kubernetes label syntax, and PSA ignores keys it does not recognise.
A bad value on the correct key behaves differently: PSA rejects a namespace create or label update whose value is not one of the three levels (for example Restricted), and a trailing space is not valid label syntax at all.
Root Cause
Pod Security Admission is a built-in admission controller that reads specific well-known label keys on the Namespace object at request time.
If the enforce label key is misspelled or uses the wrong case, PSA treats the namespace as having no enforce label and falls through to the cluster default, which is typically privileged (no restriction) unless a cluster-wide PodSecurity admission configuration sets a stricter default.
The namespace manifest is syntactically valid Kubernetes YAML, so kubectl apply, static YAML linting and generic policy-as-code checks that only validate label syntax will not catch the mismatch. The failure is deceptive because the operator can visually scan the namespace definition, see a label that looks correct, and reasonably conclude protection is active.
Impact
Any workload deployed into the affected namespace can request privileged containers, hostPath volumes, host networking or hostPID/hostIPC without admission-time rejection, which materially increases the blast radius of a compromised container or a misconfigured deployment pipeline that targets the wrong namespace. This is a silent control gap: no alert fires, no admission event is logged, because from the API server’s perspective enforcement was never configured for that namespace in the first place.
Diagnosis
Confirm the namespace’s actual applied labels rather than the source YAML, since the source file and the live object can diverge, and because visual inspection of YAML easily misses a one-character misspelling or case mismatch in a label key.
- Retrieve the live namespace labels directly from the API server, not from the manifest file on disk.
- Compare the exact key and value against the three PSA-recognised levels:
privileged,baseline,restricted. - Attempt a dry-run apply of a manifest that should be rejected under
restricted(for example a pod requestingprivileged: true) using--dry-run=server, which exercises the real admission chain without creating a persistent object. - Check whether a cluster-wide
PodSecurityConfigurationadmission plugin config sets a different default enforce level, which changes the fallback behaviour when a namespace label is absent or malformed.
Following along? Tap a step’s number to tick it off.
Correction
Correct the namespace label to the exact recognised key and one of the three exact recognised values, then re-verify enforcement with a server-side dry run before relying on it in production. Do not assume the fix is complete once the label text visually matches; re-run the dry-run rejection test to get positive confirmation from the admission controller itself.
Validation
Validation succeeds only when a server-side dry run of a manifest that violates the intended Pod Security Standard is rejected with an explicit PSA violation message referencing the correct enforce level.
- Run a server-side dry-run apply of a manifest requesting
privileged: trueagainst the corrected namespace and confirm the API server returns an admission denial citing therestricted(or intended) policy. - Run the same dry run against a namespace known to be correctly configured and confirm the denial message format matches, to rule out a coincidental unrelated rejection.
- Retrieve the namespace object again and confirm the label key is byte-for-byte
pod-security.kubernetes.io/enforceand its value is one of the three recognised levels.
Rollback
If the corrected label unexpectedly blocks a workload that must continue running while the workload itself is remediated, do not disable Pod Security Admission cluster-wide. Instead, temporarily set the namespace’s enforce level to a less restrictive but still defined value such as baseline, and set the audit and warn labels to restricted so violations remain visible without blocking traffic, then track remediation of the underlying workload separately.
Prevention
Add a policy-as-code check to CI/CD that queries the live namespace object (not the source manifest) after apply and asserts the enforce label matches one of the three exact recognised values, so environment drift or apply-order issues are caught immediately.
Include a scheduled server-side dry-run rejection test against a known-bad manifest as a synthetic monitor, since this exercises the actual admission behaviour rather than trusting label presence alone. Treat any namespace lacking a passing synthetic rejection test as unprotected regardless of what its labels appear to say.
Related reading
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
restrictedprivileged: truekubectl applyWhen to escalate
Validation and rollback are covered in the sections above.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
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
Last updated
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.
Found this useful? Follow KBY for more like it.

