Skip to main content

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

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify noncompliant namespaces (run on any machine with kubectl access):
  2. Choose the desired enforcement level for each namespace:
    • Use baseline to allow most workloads while blocking known unsafe patterns.
    • Use restricted for the strongest isolation where workloads can comply.
  3. Label a single namespace to enforce baseline (run on any machine with kubectl access):
  4. Or label a single namespace to enforce restricted:
  5. Optionally label multiple namespaces at once (example with baseline):
  6. Verify compliance (run on any machine with kubectl access):
    Confirm that all relevant namespaces show enforce=baseline or enforce=restricted and is_compliant=true.
On any machine with kubectl access:
  1. Identify noncompliant namespaces
  1. Label each target namespace to enforce baseline (adjust names as needed; use restricted instead if you choose that policy):
For many namespaces at once:
  1. Verification
Run the same audit used by the check: