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 (any machine with kubectl access):
  2. For each affected pod, determine the owning controller (any machine with kubectl access). Replace NAMESPACE and POD_NAME:
    • If empty: pod is standalone.
    • If present: note .kind and .name to edit the right controller (e.g., Deployment, DaemonSet, StatefulSet).
  3. Edit the owning controller or pod manifest to remove privileged mode (any machine with kubectl access). Examples (run one appropriate command per affected workload):
    • Deployment:
    • DaemonSet:
    • StatefulSet:
    • Standalone Pod:
    In the opened manifest, locate each container (including initContainers) and remove or change:
    to either remove privileged entirely or explicitly set:
    If specific kernel capabilities are required, add only those instead of privileged:
  4. If workloads are managed via manifest files or GitOps, update the source manifests (on your config/IaC repo workstation) so changes are not reverted. In each relevant YAML file, apply the same securityContext edits as in step 3, then re-apply:
  5. Allow pods to be recreated with the new spec. For controllers this happens automatically; for standalone pods you may need to delete and recreate them if the spec is immutable (any machine with kubectl access):
  6. Verify no containers are running privileged (any machine with kubectl access):
    Ensure the output is either is_compliant=true or that every listed line ends with is_compliant=true.
On any machine with kubectl access:
  1. Identify the owning controller of the privileged pod
Use the audit output to see owner=.... If you only have the pod name, re-fetch it:
If this prints a kind such as Deployment/StatefulSet/DaemonSet/Job, you must edit that controller, not the pod.
  1. Export the current manifest for the owning controller
Example for a Deployment (substitute the correct kind/name/namespace):
For other controller types:
  1. Edit the manifest to remove privileged mode and (optionally) add specific capabilities
Open the exported file and, for every container (including initContainers) that has securityContext.privileged: true, remove that field or set it to false. If you need specific kernel capabilities, set them explicitly.Minimal example patch in the pod template:
Ensure no container has privileged: true under securityContext.
  1. Apply the updated manifest
This will cause a rolling update for Deployments/StatefulSets/DaemonSets; pods will be recreated with the new security context.
  1. (Optional) Delete any existing non-compliant pods to accelerate rollout
For a Deployment:
Adjust the label selector to match your workload.
  1. Verification
After the rollout completes, rerun the benchmark audit command from any machine with kubectl access:
Confirm that all listed containers show privileged=false and is_compliant=true, or that the output is is_compliant=true.