Skip to main content

More Info:

Use network policies to isolate traffic in your cluster network.

Risk Level

Low

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CIS EKS
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Manual Steps

  1. List namespaces that currently lack any NetworkPolicy (run on any machine with kubectl access):
  2. For each namespace in the list, decide the default isolation behavior you want:
    • Most restrictive (recommended starting point): deny all ingress and egress by default, then create additional NetworkPolicies later to allow required flows.
    • Ingress-only isolation: deny all ingress but allow all egress.
    • Custom: define specific allowed selectors/ports/namespaces as needed.
  3. To apply a default deny all ingress and egress NetworkPolicy for one namespace (replace TARGET_NAMESPACE with the namespace name; run on any machine with kubectl access):
  4. If you prefer to only deny ingress and leave egress open for a namespace (replace TARGET_NAMESPACE; run on any machine with kubectl access):
  5. For critical namespaces (for example kube-system, monitoring, logging), review application requirements before applying default deny:
    • List pods and labels to plan selectors:
    • Start with default deny (Step 3 or 4), then iteratively add additional NetworkPolicies that:
      • Select specific pods via podSelector.matchLabels
      • Allow required ingress/egress based on from/to (e.g., namespaceSelector, podSelector, ipBlock) and ports.
  6. Verify that all namespaces now have at least one NetworkPolicy (run on any machine with kubectl access):
On any machine with kubectl access:
  1. Identify namespaces without NetworkPolicies (reuse the audit logic)
  1. For each listed namespace, create at least one NetworkPolicy. Below is a conservative default‑deny ingress and allow‑all egress policy you can apply per namespace (replace NAMESPACE_HERE each time):
Create a manifest file, for example:
Apply it to the target namespace:
Repeat editing namespace: NAMESPACE_HERE and applying for each namespace in $ns_without_np. Example loop to generate and apply identical policy to every namespace missing one:
  1. Verification (same machine with kubectl):

Additional Reading: