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
HighAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify all noncompliant pods
- Run on: any machine with kubectl access
-
Locate and edit the owning workload manifest(s)
- For each noncompliant pod, find the controller and kind:
- Export the current manifest for that controller (example for a Deployment):
- Edit the file:
-
Add
securityContext.capabilities.drop: ["ALL"]to each container- In the manifest’s pod template (
spec.template.spec.containersand, if present,spec.template.spec.initContainers), ensure each container has:
- If
securityContextorcapabilitiesalready exists, merge without removing other needed fields (e.g.,runAsNonRoot,readOnlyRootFilesystem).
- In the manifest’s pod template (
-
Apply the updated manifest
- Run on: any machine with kubectl access
- For other controller kinds (StatefulSet, DaemonSet, Job, CronJob), export, edit, and apply their manifests similarly.
-
Handle pods without controllers (bare Pods)
- If
ownerReferencesis empty, export and edit the Pod manifest directly:
- Add the same
securityContext.capabilities.drop: ["ALL"]stanza to each container, then recreate the pod:
- If
-
Verify compliance
- Run on: any machine with kubectl access
- The environment is compliant when the command outputs only
is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:
- Identify the noncompliant Pod and its owner (from the audit output). If the Pod is owned by a higher-level resource (Deployment, DaemonSet, Job, etc.), you must patch that owner; changes to a standalone Pod will be lost when it is recreated.
-
Example: patch a Deployment to drop all capabilities for all app containers.
Edit
/tmp/deploy-capabilities.yamlso each container (and initContainer, if present) has:Then apply:This will trigger a rollout of the Deployment. -
Example: patch a standalone Pod (not recommended for controllers, but works for ad‑hoc Pods):
Edit each
containersandinitContainersentry as above, adding:Then delete and recreate the Pod from the edited manifest: -
Verification (same machine with kubectl access):
Confirm
is_compliant=truefor all relevant containers.
Automation
Automation

