More Info:
Namespaces without NetworkPolicy objects allow unrestricted pod-to-pod traffic. Every namespace holding user workloads should have at least one NetworkPolicy defined.Risk Level
HighAddress
SecurityCompliance Standards
- CIS GKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List namespaces missing NetworkPolicy objects
Run on: any machine with kubectl accessSave the output list of namespaces; you will create at least one NetworkPolicy in each. -
For a selected namespace, create a baseline “default deny ingress” NetworkPolicy
Run on: any machine with kubectl access
ReplaceTARGET_NAMESPACEwith the namespace you are fixing (for each namespace, repeat with its name): -
(Optional but recommended) Add a default deny egress policy for the namespace
Run on: any machine with kubectl access
ReplaceTARGET_NAMESPACEwith the namespace name: -
(Optional) Create explicit allow policies to restore required traffic
Run on: any machine with kubectl access
Example: allow all pods in the same namespace to talk to each other (adapt as needed per application): -
Repeat for all namespaces that were missing NetworkPolicies
Run on: any machine with kubectl access
For each namespace identified in step 1, create at least one NetworkPolicy (for example, the default deny policies plus any needed allow rules) by repeating steps 2–4 with the appropriate namespace name. -
Verify all namespaces now have at least one NetworkPolicy
Run on: any machine with kubectl accessThe check is remediated when the command printsALL_NAMESPACES_HAVE_NETWORK_POLICIES.
Using kubectl
Using kubectl
Automation
Automation

