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 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. -
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
deploymentwithstatefulset,daemonset,job, orcronjobas appropriate. -
In the saved manifest file, add a
securityContext.capabilities.drop: ["ALL"]to every container (includinginitContainers) underspec.template.spec. For example:If specific Linux capabilities are required, list them underadd:explicitly; otherwise omitadd:. -
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.
-
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 anyownerReferences. - Under
spec.containers[]andspec.initContainers[]add:
- Remove
-
Verify compliance (run on any machine with kubectl access):
The output must be
is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access to the cluster:
-
Identify the noncompliant pod and its owning controller (from the audit output’s
owner=field). For example, if you see:then you must edit theDeployment/my-appin thedefaultnamespace (never edit only the live Pod). -
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 underadd. Examplespec.template.specsnippet:Save and exit; Kubernetes will roll out updated Pods with the new securityContext. -
For objects not managed by higher-level controllers (for example, a standalone Pod manifest in Git), update the source manifest similarly, then apply:
-
Verification (from any machine with kubectl):
Confirm all listed
is_compliant=values aretrue(or that no rows are output, meaning all applicable pods comply).
Automation
Automation

