Skip to main content

More Info:

Verifies no pod sets hostPID, hostIPC or hostNetwork. Sharing a host namespace breaks the isolation boundary between the pod and the node.

Risk Level

Critical

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify non-compliant pods (run on any machine with kubectl access):
  2. For each non-compliant pod, determine its owner (run on any machine with kubectl access):
    • If there is no ownerReference, the Pod is standalone and must be fixed directly.
    • If there is an owner (Deployment, DaemonSet, StatefulSet, Job, etc.), you must edit that owner resource instead of the Pod.
  3. Edit the owning workload (preferred) to remove host namespace sharing (run on any machine with kubectl access):
    In the opened manifest:
    • Locate .spec.template.spec.hostPID, .spec.template.spec.hostIPC, and .spec.template.spec.hostNetwork.
    • Set each present field to false:
      or delete the lines entirely so they are omitted. Save and exit; Kubernetes will recreate pods from this workload. Be aware this may restart application pods and briefly disrupt traffic.
  4. If the Pod is standalone (no controller), edit or recreate it from a manifest (run on any machine with kubectl access):
    • If you have a manifest in version control, update it so the pod spec does not set these fields (omit them or set to false):
      Then:
    • If there is no manifest, export, edit, and re-create:
      This will delete and recreate the pod; expect a restart and potential brief downtime.
  5. Repeat steps 2–4 for all pods reported as is_compliant=false, ensuring all updated specs have hostPID, hostIPC, and hostNetwork either omitted or explicitly set to false.
  6. Verify remediation (run on any machine with kubectl access):
    Confirm the output is is_compliant=true and that no lines show is_compliant=false.
On any machine with kubectl access:
  1. Identify offending pods and their controllers (exclude system namespaces per the audit):
  1. For each owning controller (Deployment, DaemonSet, StatefulSet, Job, CronJob, or bare Pod), export its manifest:
  1. Edit the manifest to remove or explicitly set the host namespace fields under spec.template.spec (or spec for a bare Pod):
For bare Pods (not managed by a controller):
  1. Apply the updated manifest:
If you had to delete and recreate a bare Pod:
  1. Verification (re-run the audit and confirm all non-system pods are is_compliant=true):