Containers share the host network namespace
Description
When using the host network mode for a container, that container’s network stack is not isolated from the Docker host, so the container shares the host’s networking namespace and does not get its own IP-address allocation.
To limit an attacker's options to escalate privileges from within a container, we recommend you to configure containers to not share the host network namespace.
Fix - Buildtime
Kubernetes
- Resource: Pod / Deployment / DaemonSet / StatefulSet / ReplicaSet / ReplicationController / Job / CronJob
- Argument: hostNetwork (Optional)
If true, the Pod uses the host's network namespace. Default to false.
```yaml Pod
apiVersion: v1
kind: Pod
metadata:
name:
```yaml CronJob
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: <name>
spec:
schedule: <>
jobTemplate:
spec:
template:
spec:
+ hostNetwork: false # or do not include hostNetwork
yaml Other
apiVersion: <>
kind: <kind>
metadata:
name: <name>
spec:
template:
spec:
+ hostNetwork: false # or do not include hostNetwork