Ensure that containers are prohibited from being admitted if they have "hostPID" set to true. The "hostPID" flag should be restricted because it allows containers to share the host operating system's Process ID (PID) namespace. Sharing the host's PID namespace grants the container the ability to view, and potentially interact with, all processes running on the host node, including those belonging to the Kubernetes system (like the Kubelet) or other isolated containers.
Since a container in the host's PID namespace can inspect external processes, and potentially escalate privileges if granted ptrace capabilities, an admission control policy must be defined to block host PID sharing. If containers require **hostPID: true**, implement a separate, restrictive policy. Access to this policy must be strictly governed, allowing use only by limited service accounts and users.
Audit
To determine if the containers are permitted to operate with the "hostPID" flag set to true, perform the following operations:
Remediation / Resolution
To ensure that containers are not permitted to run with the "hostPID" 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