Why it matters
A hostPath volume exposes the node's filesystem to the pod. Writing to it, or reading the kubelet's or the container runtime's files, is a route to the node.
How to fix it
Replace the hostPath volume with a persistent volume, a ConfigMap or an emptyDir.
What TrustIvan reads
Read through the Kubernetes API with the read-only role TrustIvan's install creates.
Benchmark controls
- CIS Kubernetes Benchmark 1.9.0, control
5.2.12: HostPath volumes are minimised. Also checked for this control: Workload mounts the container runtime socket - NSA/CISA Kubernetes Hardening Guidance 1.2, control
pod.security-enforcement: Pod security is enforced. Also checked for this control: Container keeps the default capabilities, Container adds a dangerous capability, Container may escalate privileges, Container runs privileged, Container mounts /proc unmasked, Container runs as a Windows HostProcess, Namespace enforces no Pod Security Standard, Namespace enforces only Pod Security baseline, Workload shares the host IPC namespace, Workload shares the host network, Workload shares the host process namespace, Workload mounts the container runtime socket
Control numbers are the published ones; the titles are TrustIvan's own short descriptions. The benchmarks belong to their publishers, who do not endorse TrustIvan.
Related checks
- Workload shares the host network
KubernetesSeverity: High
k8s.workload.host-network - Workload shares the host process namespace
KubernetesSeverity: High
k8s.workload.host-pid - Workload shares the host IPC namespace
KubernetesSeverity: High
k8s.workload.host-ipc - Workload mounts the container runtime socket
KubernetesSeverity: Critical
k8s.workload.runtime-socket - Workload runs as the default service account
KubernetesSeverity: Low
k8s.workload.default-service-account - Workload has an API token mounted
KubernetesSeverity: Low
k8s.workload.token-automounted
Terms: KSPM (Kubernetes security posture management), Kubernetes RBAC, NSA/CISA Kubernetes Hardening Guidance, CIS Benchmarks
All Kubernetes posture checks · The whole catalogue · How this works in TrustIvan · Documentation