Review GKE VPC-native networking

Plan Pod and Service address ranges and check the cluster’s actual networking mode.

Description

A VPC-native GKE cluster assigns Pod IPv4 addresses from a secondary subnet range. New clusters default to this mode. If the setting is omitted, check the deployed cluster.

Potential impact

Undersized Pod or Service ranges can limit growth. Overlap with a connected network can break connectivity. Routes-based clusters also lack dual-stack support.

Remediation

For a new cluster, set networking_mode = "VPC_NATIVE" and plan address capacity for Pods and Services. An existing routes-based cluster cannot change modes in place. Create a separately named cluster in a separate Terraform resource and test workload connectivity and access policies before moving traffic.

Examples

The excerpts compare ROUTES and VPC_NATIVE under the same name. Supply the project, VPC and subnet. The empty ip_allocation_policy selects no specific range, so check assigned ranges and available capacity after creation.

Before

hcl
resource "google_container_cluster" "cluster" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3
  networking_mode    = "ROUTES"

  ip_allocation_policy {}

  timeouts {
    create = "30m"
    update = "40m"
  }
}

After

hcl
resource "google_container_cluster" "cluster" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3
  networking_mode    = "VPC_NATIVE"

  ip_allocation_policy {}

  timeouts {
    create = "30m"
    update = "40m"
  }
}

Manage traffic and access separately with firewall rules, network policies and IAM.

References