Ensure that containers are prohibited from being admitted if they have "hostNetwork" set to true. The "hostNetwork" flag should be restricted because it allows containers to share the host operating system's network namespace. When a container uses the host network namespace, i.e., **hostNetwork: true**, it essentially bypasses the standard network isolation provided by Kubernetes and the container runtime.
A container running in the host's network namespace can access the local loopback device and network traffic to and from other Pods. Therefore, you must define at least one admission control policy that prohibits containers from sharing the host network namespace.
Audit
To determine if the containers are permitted to operate with the "hostNetwork" flag set to true, perform the following operations:
Remediation / Resolution
To ensure that containers are not permitted to run with the "hostNetwork" flag set to true, perform the following operations:
References
- Oracle Cloud Infrastructure Documentation
- Overview of Kubernetes Engine (OKE)
- Managing Kubernetes Clusters
- Setting Up Cluster Access
- Accessing a Cluster Using Kubectl
- About Access Control and Kubernetes Engine (OKE)
- Oracle Cloud Infrastructure CLI Documentation
- compartment list
- cluster list
- cluster create-kubeconfig
- Kubernetes Documentation
- Using RBAC Authorization