For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/kubernetes-pod-misconfigured-network-policy.md.
A documentation index is available at /llms.txt.
Each Pod should be targeted by a NetworkPolicy that includes both ingress and egress rules.
For Pods in the same namespace, a matching NetworkPolicy is determined by namespace. For Pods in a different namespace, the NetworkPolicy must explicitly select the Pod via spec.podSelector.matchLabels.
A NetworkPolicy satisfies ingress or egress if it lists the respective type in spec.policyTypes. When spec.policyTypes is omitted, ingress is treated as present, while egress is considered present only if spec.egress is non-empty.