More Info:
Containers sharing the host network namespace can access node network interfaces and bypass network segmentation. Their admission should be restricted via Pod Security Admission policies.Risk Level
HighAddress
SecurityCompliance Standards
- CIS AKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify namespaces with user workloads
- Run on: any machine with kubectl access
Decide which namespaces contain user workloads (exclude core system namespaces such askube-system,kube-node-lease,kube-public,gatekeeper-system, etc., unless you intentionally run user apps there). -
Review current Pod Security Admission labels on those namespaces
- Run on: any machine with kubectl access
Confirm whetherpod-security.kubernetes.io/enforceis set torestricted(preferred) or a weaker level, and whether anywarnlabels are in use. -
Check for existing Pods using hostNetwork in each user-workload namespace
- Run on: any machine with kubectl access
For each listed Pod, determine ifhostNetwork: trueis strictly required for its function or is an unnecessary elevation. -
Decide the policy level per namespace based on business and technical need
- For most user-workload namespaces, plan to enforce
restricted, which disallowshostNetwork: true. - For namespaces that legitimately need
hostNetwork(for example, certain node networking agents), consider:- Keeping them unlabelled or at
baseline, and - Documenting the justification and who is allowed to deploy there.
- Keeping them unlabelled or at
- For most user-workload namespaces, plan to enforce
-
Apply or tighten Pod Security Admission labels on user-workload namespaces
- Run on: any machine with kubectl access
- To enforce restricted policy on a specific namespace (recommended default):
- Optionally add a warning label at
baselinecluster-wide to highlight less secure specs without blocking:
hostNetwork: truein namespaces whererestrictedis enforced. -
Verify enforcement and resulting behavior
- Confirm labels:
- Attempt to create a test Pod with
hostNetwork: truein arestrictednamespace to confirm it is rejected (do not deploy in production namespace if you want to avoid noise; use a non-critical test namespace with the same labels):
restrictednamespace, demonstrating that new hostNetwork pods are minimized. - Confirm labels:
Using kubectl
Using kubectl
- Namespaces with user workloads that are missing
pod-security.kubernetes.io/enforceor have it set toprivilegedorbaseline. - Namespaces where you expect restrictions but see no
pod-security.kubernetes.io/warnlabel either (no visibility into policy violations).
ENFORCEis empty orprivileged/baselinein namespaces that run user workloads.WARNis empty where you want to be warned about non‑compliant Pods.
- Any line where
hostNetworkistruein non‑system namespaces (i.e., notkube-system,gatekeeper-system, etc.). - These Pods are currently using the host network and may not be blocked by Pod Security Admission.
- Namespace
prodhas nopod-security.kubernetes.io/enforce=restrictedlabel but contains Pods withhostNetwork=true. - This combination indicates a higher‑risk configuration needing human review.
- Events mentioning
pod-security.kubernetes.io:- Messages like “violates PodSecurity ‘restricted’” for hostNetwork use (means enforcement is working).
- Only warning annotations or no mention of PodSecurity (means hostNetwork might not be blocked).
Automation
Automation
- Section 1:
- User-workload namespaces with no
pod-security.kubernetes.io/enforcelabel, or with a value weaker than your policy (e.g., unset where you expectrestricted).
- User-workload namespaces with no
- Section 2:
- Any listed pod in a user-workload namespace using
hostNetworkthat is not explicitly justified by your security/design requirements.
- Any listed pod in a user-workload namespace using
- Section 3:
- Any namespace shown here is a higher-priority concern: it has
hostNetworkpods but lacksenforce=restricted, so admission controls are not aligned with the benchmark guidance.
- Any namespace shown here is a higher-priority concern: it has

