Skip to main content

More Info:

Without NetworkPolicy objects, all pods can communicate freely, enabling lateral movement. Install a NetworkPolicy-capable provider such as Calico and define policies for every namespace.

Risk Level

High

Address

Security

Compliance Standards

  • CIS OKE

Triage and Remediation

Remediation

Manual Steps

  1. Confirm current CNI and NetworkPolicy support
    • On any machine with kubectl access:
    • Review CNI pods (e.g., flannel, calico-node, cilium-...). If only flannel (or another non–NetworkPolicy-capable CNI) is present, plan to deploy a NetworkPolicy-capable provider (for example, Calico in “Calico + flannel” mode) following its official documentation before proceeding with policy design.
  2. Inventory namespaces and existing NetworkPolicies
    • On any machine with kubectl access:
    • Identify namespaces without any NetworkPolicy:
    • List all namespaces where the count is 0; these are in scope for remediation.
  3. Classify each namespace’s intended traffic model
    • For each namespace (especially those with 0 policies), gather workload info:
    • With the application owners, decide for each namespace:
      • Which external CIDRs or namespaces may reach its pods (ingress).
      • Which destinations (namespaces, services, or CIDRs) its pods must contact (egress).
      • Whether intra-namespace pod-to-pod traffic should be allowed by default or restricted.
  4. Design and apply baseline NetworkPolicies per namespace
    • For each namespace lacking policies, create at least a minimal, reviewed policy manifest. Examples to adapt (save and edit before applying):
      • Default deny all ingress/egress (tightest posture):
      • Allow intra-namespace traffic but deny cross-namespace by default:
    • Apply with kubectl from any machine with kubectl access:
    • Add additional, narrower policies (per app labels) as needed to explicitly permit required ingress/egress.
  5. Functionally validate impact with test pods
    • In at least one hardened namespace, run a temporary debug pod:
    • From that pod, test expected/blocked connectivity (adjust hostnames/IPs):
    • Confirm results align with the designed policy (required paths work, disallowed paths fail). Adjust NetworkPolicies iteratively if necessary.
  6. Re-verify cluster-wide compliance
    • After policies are in place and validated, re-run evidence collection from any kubectl-capable machine:
    • Confirm every non-system namespace has at least one intentional, documented NetworkPolicy and that a NetworkPolicy-capable CNI is deployed and healthy.

Using kubectl

Run these commands from any machine with kubectl access.
  1. List all namespaces and see which have zero NetworkPolicies:
What indicates a problem: Any namespace that shows 0 means there is no NetworkPolicy at all in that namespace, so pod-to-pod traffic there is completely unrestricted at the Kubernetes layer.
  1. View namespaces with and without NetworkPolicies in a more visual way:
What indicates a problem:
  • No resources found in <namespace> namespace. → that namespace has no NetworkPolicies.
  • Namespaces that only have very permissive policies (for example, a policy that selects all pods and allows all ingress and egress from/to all namespaces/CIDRs) may be effectively equivalent to having no policy and should be reviewed by a human.
  1. Check which CNI plugin is running on the nodes (to confirm NetworkPolicy support):
What indicates a problem:
  • If you only see flannel-related pods (for example, kube-flannel-ds-*) and no NetworkPolicy-capable CNI such as calico, cilium, antrea, weave-net, etc., then NetworkPolicy objects will not be enforced even if they exist.
  1. Inspect the details of existing NetworkPolicies in a specific namespace (replace NAMESPACE as needed):
What indicates a problem:
  • Policies that have podSelector: {} and allow all ingress/egress from everywhere (e.g., from: [] or to: [] or broad ipBlock ranges) can indicate a configuration that does not meaningfully restrict traffic and should be assessed manually.