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 pods (run on any machine with kubectl access):
  2. For a privileged pod that is controlled by a higher-level object (e.g., Deployment/DaemonSet/StatefulSet), edit the controller (run on any machine with kubectl access). Example for a Deployment:
    In the editor, locate each affected container or initContainer and remove or change:
    If specific kernel capabilities are needed, add only those:
  3. For a privileged pod that is not controlled by any owner (standalone Pod), edit or recreate its manifest (run on any machine with kubectl access):
    Edit /tmp/pod-POD_NAME.yaml and, for each container or initContainer, remove:
    or replace with a minimal capabilities block as needed:
    Then reapply:
  4. If multiple workloads share the same pattern, update their source manifests or Helm charts (run where your manifests/Helm live) so that future deployments do not reintroduce:
    and instead use only required securityContext.capabilities.add entries.
  5. Wait for updated workloads to roll out (run on any machine with kubectl access):
  6. Verify no remaining privileged containers (run on any machine with kubectl access):
On any machine with kubectl access:
  1. Identify all privileged containers (for context before changing anything):
  1. For each affected pod that is managed by a higher-level controller (Deployment, StatefulSet, DaemonSet, Job, CronJob), edit the controller manifest so that new pods are created without privileged: true.
Example for a Deployment (replace names/namespace as needed):
In the editor, in each affected container (and initContainer) under spec.template.spec.containers (or initContainers), remove or change:
If specific kernel capabilities are required, replace with only the needed ones, for example:
Save and exit; Kubernetes will roll out updated pods automatically.
  1. For pods created directly (not via a controller), export, modify, and re-apply:
Edit /tmp/my-pod-fixed.yaml:
  • Remove metadata.creationTimestamp, metadata.resourceVersion, metadata.uid, metadata.selfLink, metadata.managedFields, status sections if present.
  • Under each affected container/initContainer, remove securityContext.privileged: true or replace with a minimal securityContext.capabilities.add block as required.
Then delete and recreate the pod:
  1. Verification (same machine with kubectl access):