GKE Operations: Control Plane, Node Pools & Pod IP Allocation

Master Google Kubernetes Engine (GKE) Autopilot vs Standard, VPC-Native Alias IP networking, Node Pool management, and pod identity delegation via Workload Identity.

advanced 25 min lesson hands-on task included

Google Kubernetes Engine (GKE) is Google’s managed Kubernetes service. Because Kubernetes originated inside Google (from Borg), GKE features deep, native integration into GCP’s networking, IAM, and observability stacks.


Topic 1: GKE Standard vs. Autopilot

GKE CLUSTER TOPOLOGY — CONTROL PLANE, ALIAS IP & WORKLOAD IDENTITY MANAGED GKE CONTROL PLANE (Regional / Multi-AZ HA) kube-apiserver · etcd · kube-scheduler · cloud-controller-manager Autopilot or Standard VPC-NATIVE NETWORK TOPOLOGY (ALIAS IP RANGES) Node Pool: general-pool (n2-standard-4) Node CIDR: 10.1.0.0/24 (Primary Subnet IP) Pods (Alias IP: 10.100.0.0/14 Secondary) • Native VPC routable IPs without overlay encap • Direct connectivity to Cloud SQL & Internal LBs Node Pool: spot-pool (E2 Spot + Autoscaler) Node CIDR: 10.1.1.0/24 WORKLOAD IDENTITY BINDING K8s SA: namespace/sa-backend ↕ GCP SA: gcp-sa@proj.iam.gserviceaccount.com WHY WORKLOAD IDENTITY IS MANDATORY Eliminates mounting JSON service account key files in pod volumes. Metadata server intercepts token requests and returns short-lived IAM credentials mapped directly to the Pod's Kubernetes ServiceAccount.
GKE VPC-Native cluster topology: Control plane HA, Node Pools, secondary Alias IP subnet allocation for Pods, and Workload Identity credential translation.

GCP offers two operational modes for GKE:

FeatureGKE StandardGKE Autopilot
Node ManagementYou configure and manage Node Pools (machine types, disk sizes, OS images)Fully managed by Google — no node management or SSH
Billing ModelPay per GCE VM node provisioned (regardless of pod utilization)Pay strictly per requested Pod CPU, Memory, and Storage
CustomizationFull control over daemonsets, kernel parameters, custom node poolsEnforces hardened security benchmarks (no privileged pods)
AutoscalingCluster Autoscaler + HPA / VPAFully automated pod-driven scaling

Topic 2: VPC-Native Clusters & Alias IP Networking

In legacy Kubernetes setups (Routes-based), pod traffic requires overlay encapsulation (Flannel/VXLAN) or complex host routing.

GKE Production Standard: VPC-Native Clusters: VPC-Native clusters assign real, routable internal IP addresses to every Pod directly from the VPC subnet’s Secondary IPv4 CIDR range (Alias IPs):

  • Primary Subnet Range (10.100.0.0/20): Assigns internal IPs to GCE Node VMs.
  • Secondary Pod Range (10.200.0.0/14): Assigns IP addresses directly to Pods.
  • Secondary Service Range (10.204.0.0/20): Assigns ClusterIP addresses for K8s Services.

Benefits of VPC-Native Networking:

  1. Pods can communicate directly with Cloud SQL, Memorystore, and on-premises endpoints without NAT or gateway overlays.
  2. Better network throughput and lower latency.
  3. Network policies and VPC firewall rules can target Pod IP blocks directly.

Topic 3: Node Pool Architecture & Spot Node Pools

A Node Pool is a subset of worker nodes within a cluster that share identical machine configurations:

# Create a GKE VPC-Native Cluster with Workload Identity enabled
gcloud container clusters create prod-gke-cluster \
  --region=us-central1 \
  --enable-ip-alias \
  --subnetwork=prod-subnet-us-central1 \
  --cluster-secondary-range-name=gke-pods \
  --services-secondary-range-name=gke-services \
  --workload-pool=$(gcloud config get-value project).svc.id.goog

# Add a dedicated Spot VM Node Pool for fault-tolerant workloads
gcloud container node-pools create spot-pool \
  --cluster=prod-gke-cluster \
  --region=us-central1 \
  --spot \
  --machine-type=e2-standard-4 \
  --enable-autoscaling \
  --min-nodes=1 \
  --max-nodes=10

Topic 4: Workload Identity (Pod-Level GCP IAM)

In standard Kubernetes, pods needing access to GCP APIs (GCS, BigQuery, Cloud SQL) often mounted exported JSON service account key files stored in Kubernetes Secrets. This is a severe security vulnerability.

GKE Workload Identity links a Kubernetes ServiceAccount (K8s SA) directly to a GCP IAM ServiceAccount (GCP SA):

  1. GKE runs a metadata server daemon on every node.
  2. When a container inside a Pod queries http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token, GKE’s metadata server intercepts the call.
  3. GKE validates the Pod’s Kubernetes token, verifies the Workload Identity binding, and returns a short-lived GCP OAuth2 access token for the target GCP Service Account!
# Allow the K8s ServiceAccount 'sa-backend' in namespace 'production' 
# to impersonate the GCP Service Account 'gcp-sa-backend'
gcloud iam service-accounts add-iam-policy-binding \
  gcp-sa-backend@my-project-id.iam.gserviceaccount.com \
  --role="roles/iam.workloadIdentityUser" \
  --member="serviceAccount:my-project-id.svc.id.goog[production/sa-backend]"

Common mistake: Accepting the default secondary IP ranges when creating a VPC-native cluster. Pod and service ranges cannot be changed afterwards, and every pod consumes a real alias IP — so the cluster that sized comfortably for twenty nodes stops scheduling at sixty, and the fix is a new cluster rather than a setting.