Skip to main content

More Info:

Sharing the host network namespace gives a container access to host network interfaces and local services, bypassing network controls. Restrict it.

Risk Level

High

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. List all Pods using hostNetwork (run on any machine with kubectl access):
  2. For each affected Pod, identify its owning workload (run on any machine with kubectl access). Replace NAMESPACE and POD with real values from step 1:
    Use the kind and name fields to determine if it is controlled by a Deployment, DaemonSet, StatefulSet, Job, etc., or is a standalone Pod.
  3. For each standalone Pod that should not use host networking, edit the Pod spec and plan a recreation (run on any machine with kubectl access):
  4. For each controller-managed workload (Deployment/DaemonSet/StatefulSet/Job) that should not use host networking, edit the controller spec (run on any machine with kubectl access). Example for a Deployment:
    Repeat with deployment replaced by daemonset, statefulset, or job as appropriate.
  5. Add a restrictive admission policy in each user-workload namespace to prevent new hostNetwork Pods (run on any machine with kubectl access). Example using a Kubernetes-native PodSecurityPolicy-like Gatekeeper constraint is cluster-specific; if you do not have an admission controller already in place, document and implement one via your chosen policy engine (e.g., Kyverno, Gatekeeper) that rejects Pods with spec.hostNetwork: true in user namespaces, with explicit exceptions for justified system workloads.
  6. Verify no remaining Pods use hostNetwork (run on any machine with kubectl access):