Description
Omit hostNetwork or set it to false for ordinary Pods. Setting it to true shares the node’s IP address and port space.
Potential impact
An application listening on a node interface may be reachable from unintended networks or compete with another service for the same port.
Remediation
Configure a Service or Ingress for required external access, with authentication and network restrictions. Reserve host networking for system workloads that need it and check their actual listening addresses and ports.
Examples
Before
yaml
apiVersion: v1
kind: Pod
metadata:
name: security-context-demo
spec:
hostNetwork: true
containers:
- name: sec-ctx-demo
image: busybox
After
yaml
apiVersion: v1
kind: Pod
metadata:
name: security-context-demo
spec:
containers:
- name: sec-ctx-demo
image: busybox
The second example omits hostNetwork. Roll out the change from the workload’s Pod template or plan to replace a standalone Pod. Use network policies to manage access from other Pods.