Skip to main content

More Info:

Advisory: an admission controller (Pod Security Admission, Kyverno, or OPA Gatekeeper) should enforce workload best practices at admission time, not only detect them after the fact.

Risk Level

Medium

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Decide which admission policy engine to use (design choice)
    • If you’re on a recent Kubernetes/managed version that supports it and your needs are basic-to-moderate, prefer Pod Security Admission (PSA).
    • If you need rich, custom policies, consider Kyverno or OPA Gatekeeper, but ensure your cloud provider supports installing them (via add-ons or your existing IaC).
    • Map which C1–C5 best practices you want enforced (e.g., disallow privileged pods, require resource limits, restrict hostPath, force non‑root, control capabilities).
  2. Check if any admission policy engine is already enabled (cloud/IaC)
    • In the cloud console, open the cluster details page and look for:
      • A “Pod security” / “Pod security admission” / “Pod security standards” section and note if it is Enabled and which level (e.g., baseline/restricted).
      • Any add‑on entries for Kyverno, OPA Gatekeeper, or similar “policy” controllers.
    • In your IaC (Terraform, Helm, etc.), search for definitions referencing PSA, Kyverno, or Gatekeeper:
      • On a machine with access to your IaC repo:
  3. Review whether C1–C5-aligned policies are configured in your chosen tool (cloud/IaC)
    • For PSA via provider/IaC, look at:
      • Cluster‑level settings (e.g., default Pod Security level) in the console or in your IaC resource definitions. Confirm that “baseline” or “restricted” is set to enforce (not only audit or warn).
    • For Kyverno/Gatekeeper via IaC, inspect the policy manifests in your repo (found from the grep in step 2) and confirm they:
      • Enforce: no privileged pods, no host networking/paths unless allowed, resource requests/limits, non‑root users, and other C1–C5 items.
      • Are set to enforce (e.g., Kyverno validationFailureAction: enforce, Gatekeeper enforcementAction: deny).
  4. Decide and implement the enforcement configuration (cloud/IaC change)
    • If no engine is enabled, update your cloud provider configuration or IaC to:
      • Turn on PSA (if available) with an appropriate enforced level on namespaces (e.g., “baseline” or “restricted”), or
      • Deploy a supported policy engine add-on (Kyverno/Gatekeeper) and add policies mapped to C1–C5.
    • If an engine is present but only auditing, modify its configuration (in the console or IaC) to switch relevant rules/policies from “audit/warn” to enforce/deny for the targeted namespaces.
    • Apply the IaC changes using your normal workflow (for example, on your IaC runner machine):
  5. Verify that policies are enforced at admission time (cloud/IaC + kubectl evidence)
    • From any machine with kubectl access, intentionally try to create a pod that violates one of the C1–C5 controls (e.g., privileged container):
    • Confirm the request is rejected with an admission error message from PSA/Kyverno/Gatekeeper, rather than being created and only reported later.
  6. Document the decision and scope of enforcement (cloud/IaC)
    • In your cluster runbook or IaC repository (e.g., docs/security-policies.md), record:
      • Which admission policy engine is in use.
      • Which namespaces are covered and at what enforcement level.
      • Which C1–C5 best practices are enforced vs. only audited.
    • This documentation becomes the evidence that this manual control has been reviewed and a conscious enforcement decision has been made.
kubectl cannot configure or enable admission policy engines on a managed control plane; this is done in the cloud provider’s console, CLI, or IaC for the cluster itself. Refer to the Manual Steps section for provider-specific guidance on enabling and configuring Pod Security Admission, Kyverno, or OPA Gatekeeper.