11 - Pod network routing

Terraform was used to create a route for each Worker node so that the pods running on each node can communicate with each other.

This creates a route for each Worker node, which is why there is a count variable to iterate over the number of Worker nodes.

# route packets

resource "google_compute_route" "route" {
  count       = var.nodes
  name        = "kubernetes-route-10-200-${count.index + 1}-0-24"
  network     = google_compute_network.vpc_network.name
  next_hop_ip = "10.240.0.2${count.index + 1}"
  dest_range  = "10.200.${count.index + 1}.0/24"

  depends_on = [
    google_compute_subnetwork.private_network_1
  ]
}
Last updated on 17 Aug 2021
Published on 17 Aug 2021