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
HighAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all Pods using
hostNetwork(run on any machine with kubectl access): -
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
kindandnamefields to determine if it is controlled by a Deployment, DaemonSet, StatefulSet, Job, etc., or is a standalone Pod. -
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):
-
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
deploymentreplaced bydaemonset,statefulset, orjobas appropriate. -
Add a restrictive admission policy in each user-workload namespace to prevent new
hostNetworkPods (run on any machine with kubectl access). Example using a Kubernetes-nativePodSecurityPolicy-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 withspec.hostNetwork: truein user namespaces, with explicit exceptions for justified system workloads. -
Verify no remaining Pods use
hostNetwork(run on any machine with kubectl access):
Using kubectl
Using kubectl
Automation
Automation

