Skip to main content

More Info:

Verifies every container drops ALL capabilities and adds back only what it needs. Excess capabilities expand the attack surface of a compromised container.

Risk Level

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify offending pods and containers (run on any machine with kubectl access):
    Each line is: NAMESPACE POD_NAME CONTAINER_NAME. Use it as input for the next steps.
  2. For each non-compliant workload managed by a higher-level controller (Deployment, StatefulSet, DaemonSet, Job, CronJob), edit the controller manifest (run on any machine with kubectl access):
    Or replace deployment with statefulset, daemonset, job, or cronjob as appropriate.
  3. In the saved manifest file, add a securityContext.capabilities.drop: ["ALL"] to every container (including initContainers) under spec.template.spec. For example:
    If specific Linux capabilities are required, list them under add: explicitly; otherwise omit add:.
  4. Apply the updated manifest (run on any machine with kubectl access):
    Repeat Steps 2–4 for each affected controller. This will cause controlled rollouts of new pods.
  5. For stand-alone Pods (not owned by a controller), recreate them with the proper securityContext (run on any machine with kubectl access):
    Edit /tmp/pod-<POD_NAME>.yaml:
    • Remove metadata.uid, metadata.resourceVersion, metadata.creationTimestamp, metadata.managedFields, status, and any ownerReferences.
    • Under spec.containers[] and spec.initContainers[] add:
    Then delete and recreate:
  6. Verify compliance (run on any machine with kubectl access):
    The output must be is_compliant=true.
On any machine with kubectl access to the cluster:
  1. Identify the noncompliant pod and its owning controller (from the audit output’s owner= field). For example, if you see:
    then you must edit the Deployment/my-app in the default namespace (never edit only the live Pod).
  2. Edit the controller and add the capabilities drop to every container (including initContainers if present). Example for a Deployment:
    In the opened manifest, under each container, add a securityContext.capabilities.drop: ["ALL"]. If the container truly needs a specific capability, add it back under add. Example spec.template.spec snippet:
    Save and exit; Kubernetes will roll out updated Pods with the new securityContext.
  3. For objects not managed by higher-level controllers (for example, a standalone Pod manifest in Git), update the source manifest similarly, then apply:
  4. Verification (from any machine with kubectl):
    Confirm all listed is_compliant= values are true (or that no rows are output, meaning all applicable pods comply).