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 engine to use and scope of enforcement
    • On any machine with EKS/IaC access, choose one of:
      • Native Pod Security Admission (PSA) with EKS (recommended for baseline/restricted pod security).
      • Kyverno or OPA Gatekeeper for richer policies.
    • Decide: which namespaces must be enforced (prod vs dev), and whether to block non-compliant workloads (fail) or only warn/audit initially.
  2. Check if Pod Security Admission (PSA) is already enabled and configured (EKS)
    • On any machine with AWS CLI configured, list cluster details:
    • On any machine with kubectl access, inspect namespaces for PSA labels:
    • Look for labels like pod-security.kubernetes.io/enforce=baseline|restricted on critical namespaces (e.g., production).
    • If no such labels exist on any namespace you intend to protect, PSA is not enforcing workload policy for those namespaces.
  3. Check whether Kyverno or Gatekeeper is installed and enforcing
    • On any machine with kubectl access, check for Kyverno:
    • Check for Gatekeeper:
    • For any policies/constraints found, inspect a few to see if they are enforce (blocking) vs audit (detect-only).
  4. Compare current policy coverage against C1–C5 best practices
    • Using kubectl, review whether current enforcement covers:
      • Pod security (privileged, hostPath, hostNetwork, capabilities, etc.)
      • Resource limits/requests, non-root, image registries, etc.
    • For PSA labels, pick a protected namespace and check:
    • For Kyverno/Gatekeeper, inspect representative policies for these topics:
    • If C1–C5 topics are only checked by external scanners/CI and not by admission policies, enforcement is incomplete.
  5. Plan and implement enforcement via cloud/IaC configuration
    • If using PSA via EKS/IaC:
      • Update your IaC (e.g., Terraform, CloudFormation, eksctl) to apply appropriate labels to namespaces that must be enforced, for example (Terraform Helm/kubectl provider or eksctl config):
        • Ensure namespaces are created and labeled declaratively with:
          pod-security.kubernetes.io/enforce=baseline or restricted (and optionally warn/audit).
    • If using Kyverno or Gatekeeper:
      • Add or update IaC modules/Helm releases that install the controller into the cluster and define policies/constraints that:
        • Cover C1–C5 best practices.
        • Use enforcing modes (e.g., Kyverno validationFailureAction: enforce, Gatekeeper constraints without enforcementAction: dryrun).
    • Roll out in stages (e.g., warn/audit first, then enforce) to minimize disruption.
  6. Verify that admission enforcement is active
    • On any machine with kubectl access, attempt to create an intentionally non-compliant pod in an enforced namespace, e.g. for PSA / basic pod security:
    • Confirm that creation is rejected with an error from PSA, Kyverno, or Gatekeeper.
    • If the pod is admitted successfully, revisit steps 2–5 and strengthen or correct the admission policy configuration.
kubectl cannot configure or enable admission policy engines on Amazon EKS, because this is managed at the cloud provider / control-plane configuration layer (for example via AWS Console, CLI, or IaC such as Terraform/CloudFormation). To address this finding, follow the guidance in the Manual Steps section for configuring Pod Security Admission or deploying Kyverno / OPA Gatekeeper through your EKS provisioning tooling.