Kubernetes Pods are inspected for any container declaring ports[].hostPort. The finding highlights workloads that bind container ports directly to the node's network stack via HostPorts.
Risk
Using HostPorts exposes Pods on node IPs outside centralized Service/Ingress controls. Attackers can directly probe and access workloads (confidentiality/integrity). Port conflicts or saturation on nodes can disrupt traffic (availability). Network segmentation and some policies may be less effective.
prowler kubernetes --checks core_minimize_admission_hostport_containers
Recommendation
Avoid hostPort; publish services via ClusterIP with Ingress/LoadBalancer. Enforce admission policies to deny hostPort by default, permitting only a narrowly justified allowlist. Apply least privilege network rules, segment nodes, and monitor for unexpected host port bindings as defense in depth.
Remediation
- Open your Kubernetes Dashboard and go to Workloads
- Select the affected Deployment/DaemonSet/StatefulSet (or Pod) and click Edit
- In the YAML, remove every
hostPortfield underspec.template.spec.containers[].ports[](orspec.containers[]for a standalone Pod) - Save the changes; allow the workload to restart
- Verify the new Pods have no
hostPortdefined
Source Code
Resource Type
Pod