Other Articles

GKE – Enable Network Policy

Secure Configuration Checks > GCP

This check ensures that Google Kubernetes Engine (GKE) clusters enforce Kubernetes network policies through either the Calico network policy add-on or GKE Dataplane V2. Network policies control communication between pods and help isolate workloads within a cluster. Policies take effect only when a supported network plugin enforces them.

Check Details

  • Resource: GKE Cluster
  • Check: Enable network policy
  • Risk: Without network policy enforcement, workloads can communicate with other pods without network-policy restrictions. If a workload is compromised, an attacker may use this unrestricted communication to move laterally within the cluster and access other services.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to Kubernetes Engine > Clusters. GKE Clusters
  2. Click the affected GKE Standard cluster.
  3. Under Cluster Networking, locate Calico Kubernetes Network Policy and click Edit network policy. GKE Cluster Networking
  4. Select Enable Calico Kubernetes network policy for control plane and click Save changes. Enable GKE Network Policy
  5. Wait for the control-plane setting to finish updating. Then return to the same setting and click Edit network policy again.
  6. Select Enable Calico Kubernetes network policy for nodes and click Save changes.
  7. Wait for the node updates to complete. GKE recreates the nodes to apply network policy enforcement.

Note: These steps apply to Standard clusters using Calico. If the cluster uses GKE Dataplane V2, network policy enforcement is already built in, so you do not need to enable the Calico network policy add-on. Autopilot clusters use Dataplane V2.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. List the GKE clusters that enforce neither the network policy add-on nor Dataplane V2:

    gcloud container clusters list --format=json | jq -r '.[]
      | select((.networkPolicy.enabled // false) | not)
      | select((.networkConfig.datapathProvider // "") != "ADVANCED_DATAPATH")
      | [.name, .location]
      | @tsv'
    
  3. Turn on the network policy add-on for the control plane:

    gcloud container clusters update <CLUSTER_NAME> \
    --location <LOCATION> \
    --update-addons=NetworkPolicy=ENABLED
    
  4. Enforce network policy on the nodes:

    gcloud container clusters update <CLUSTER_NAME> \
    --location <LOCATION> \
    --enable-network-policy
    
  5. Or, create a new cluster with Dataplane V2, which enforces network policies without the add-on:

    gcloud container clusters create <NEW_CLUSTER_NAME> \
    --location <LOCATION> \
    --enable-ip-alias \
    --enable-dataplane-v2
    
  6. Verify the settings:

    gcloud container clusters describe <CLUSTER_NAME> \
    --location <LOCATION> \
    --format="yaml(networkPolicy,networkConfig.datapathProvider)"
    

    Replace <CLUSTER_NAME> with the name of your GKE cluster, <LOCATION> with its region or zone, and <NEW_CLUSTER_NAME> with a name for the new cluster. The output must show networkPolicy as enabled, or datapathProvider as ADVANCED_DATAPATH. Dataplane V2 is normally chosen when a cluster is created, so for an existing cluster that needs it, create a new one and move your workloads. Turning on the add-on uses extra resources on the nodes and recreates them in a rolling update. Enforcement alone does not block any traffic. Traffic is restricted only when you create NetworkPolicy objects, so test your policies in a non-production namespace first.

Default Value

GKE Autopilot clusters use Dataplane V2, which provides network policy enforcement by default. Standard clusters can use either the Calico network policy add-on or Dataplane V2. Network policy enforcement must be enabled for policies to take effect.

Updated on 09 November, 2026