Skip to main content

More Info:

Containers sharing the host network namespace can access node-level network interfaces and bypass network controls. Restrict admission of hostNetwork containers via namespace policies.

Risk Level

High

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify pods currently using hostNetwork (any machine with kubectl access):
  2. For each affected namespace that should host only user workloads, create or update a Baseline Pod Security admission policy that disallows hostNetwork (any machine with kubectl access). Example for namespace my-namespace:
    If you need finer control (e.g., allow for specific system workloads), instead create a custom admission policy (ValidatingAdmissionPolicy/PolicyBinding, Gatekeeper, or Kyverno) that rejects pods with spec.hostNetwork: true except for explicitly allowed service accounts.
  3. Review exceptions before tightening policies (any machine with kubectl access):
    For any pod that legitimately requires hostNetwork (e.g., CNI components), ensure it runs in a dedicated “system” namespace with an explicit exception in your admission policy, or is excluded by your policy’s namespace/label selectors.
  4. Update workload manifests to remove hostNetwork: true where not strictly required (any machine with kubectl access). For each affected pod/deployment:
    In the editor, remove or set:
  5. Redeploy any workloads that previously relied on hostNetwork only after confirming they function correctly behind normal Kubernetes networking and network policies (any machine with kubectl access). Use your CI/CD or:
  6. Verification (any machine with kubectl access):
    Confirm the output is:
Note: The above uses Kyverno as an example admission controller. If Kyverno (or a similar admission controller) is not installed, install and configure one first; kubectl alone cannot enforce admission without such a controller.