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 noncompliant pods (run on any machine with kubectl access):
  2. For a workload you control (example: Deployment in namespace “prod”), retrieve its manifest (run on any machine with kubectl access):
  3. Edit the manifest to drop all capabilities and add back only what is needed (run on any machine with kubectl access):
    • Open the file:
    • Under each containers[] and initContainers[] item, add or update:
    • Remove any unneeded capabilities from add:; keep only strictly required ones.
  4. Apply the updated manifest (run on any machine with kubectl access):
  5. Repeat steps 2–4 for each noncompliant controller or standalone Pod you manage (e.g., deployment, statefulset, daemonset, job, cronjob, or pod).
  6. Verify all non-excluded namespaces are compliant (run on any machine with kubectl access):
    Confirm remaining lines (if any) all show is_compliant=true.
On any machine with kubectl access:
  1. Identify non‑compliant pods and their owning controllers
This lists: NAMESPACE POD OWNER_KIND OWNER_NAME. For entries where OWNER_KIND is empty, you must edit the Pod directly; otherwise edit the owning object (Deployment, StatefulSet, DaemonSet, Job, CronJob, etc.).
  1. Edit the owning controller manifest(s)
For each non‑compliant controller (example: a Deployment in namespace prod named web):
Under every spec.template.spec.containers[] and spec.template.spec.initContainers[] entry, add:
Maintain any existing securityContext fields; just merge the capabilities stanza. Save and exit to apply.
  1. Edit standalone Pods (no controller)
For a Pod in namespace default named test-pod with no owner:
Add the same block to each container and initContainer:
Note: direct Pod edits are not persisted if something external (e.g., Helm, GitOps) recreates them; prefer fixing source manifests/IaC where applicable.
  1. Declarative example for future manifests
When authoring or updating manifests, ensure each container includes:
Apply with:
  1. Verification
Run the benchmark audit command again from any machine with kubectl access:
Confirm output is is_compliant=true only, or that each listed container shows is_compliant=true.