Skip to main content

More Info:

Verifies no container sets securityContext.privileged=true. A privileged container can compromise the node and every other pod scheduled on it.

Risk Level

Critical

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify all privileged containers
    • Run on any machine with kubectl access:
  2. For each offending pod, locate and edit the owning workload manifest
    • Run on any machine with kubectl access, example for a Deployment owner from step 1:
    • In /tmp/deployment-<DEPLOYMENT_NAME>.yaml, under the affected container or initContainer, remove or change:
    • If specific kernel access is required, add only needed capabilities instead of privileged:
  3. Apply the updated manifest
    • Run on any machine with kubectl access:
  4. If the pod is not managed by a higher-level controller (standalone Pod)
    • Run on any machine with kubectl access:
    • Edit /tmp/pod-<POD_NAME>.yaml to remove securityContext.privileged: true (and optionally add minimal securityContext.capabilities.add as needed), then re-create the pod:
  5. Repeat for all other controllers (DaemonSet, StatefulSet, Job, CronJob)
    • Use the owner information from step 1 (e.g. owner=DaemonSet/ns/name/uid) and follow steps 2–3, replacing deployment with the appropriate kind:
  6. Verify no containers are still privileged
    • Run on any machine with kubectl access:
    • Confirm the output is is_compliant=true and that no line shows privileged=true.
On any machine with kubectl access:
  1. Identify the offending pod and its owner
Decide whether to:
  • Edit a standalone Pod, or
  • Edit the owning controller (Deployment/DaemonSet/StatefulSet/Job/CronJob, etc.).
  1. Remove securityContext.privileged: true from the controller manifest
Example: Deployment named my-deployment in namespace my-namespace:
Edit /tmp/my-deployment.yaml and, for each offending container (including initContainers), remove or change:
If specific capabilities are required, replace with a minimal capability set, for example:
Apply the updated manifest:
Repeat this pattern for other controller types, e.g.:
For a standalone Pod that is not managed by a controller (uncommon in production), recreate it without securityContext.privileged: true:
  1. Verification
On any machine with kubectl access, re-run the compliance check:
The cluster is compliant when the output is only: