More Info:
Verifies each namespace is labeled with pod-security.kubernetes.io/enforce set to baseline or restricted so the built-in Pod Security Admission controller rejects unsafe pods.Risk Level
HighAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On any machine with kubectl access, list all namespaces and identify those without an enforce label or with an incorrect value (excluding system namespaces):
-
For each non-system namespace that should be set to baseline, apply the label:
-
For each non-system namespace that should be set to restricted, apply the label:
-
(Optional but recommended) Set the enforce-version label so behavior is consistent across upgrades (replace v1.28 with the API version you target):
-
(Optional) If you use GitOps/manifests for namespace definitions, add the labels to the Namespace manifests and re-apply them from any machine with kubectl access:
Apply:
-
Verification (on any machine with kubectl access): run the same audit logic and confirm all non-exempt namespaces show enforce=baseline or enforce=restricted with is_compliant=true:
Using kubectl
Using kubectl
On any machine with kubectl access:Apply it with:
- Create a manifest labeling all existing non-system namespaces with
baseline(edit torestrictedif desired):
- Apply the manifest:
- For any new namespace you create, include the label in its manifest, for example:
- Verification (same logic as the audit, using kubectl):
Automation
Automation

