Switch branches/tags
Find file Copy path
07aae4f Dec 18, 2017
1 contributor

Users who have contributed to this file

61 lines (43 sloc) 2.16 KB

Provisioning Pod Network Routes

Pods scheduled to a node receive an IP address from the node's Pod CIDR range. At this point pods can not communicate with other pods running on different nodes due to missing network routes.

In this lab you will create a route for each worker node that maps the node's Pod CIDR range to the node's internal IP address.

There are other ways to implement the Kubernetes networking model.

The Routing Table

In this section you will gather the information required to create routes in the kubernetes-the-hard-way VPC network.

Print the internal IP address and Pod CIDR range for each worker instance:

for instance in worker-0 worker-1 worker-2; do
  gcloud compute instances describe ${instance} \
    --format 'value[separator=" "](networkInterfaces[0].networkIP,metadata.items[0].value)'



Create network routes for each worker instance:

for i in 0 1 2; do
  gcloud compute routes create kubernetes-route-10-200-${i}-0-24 \
    --network kubernetes-the-hard-way \
    --next-hop-address${i} \
    --destination-range 10.200.${i}.0/24

List the routes in the kubernetes-the-hard-way VPC network:

gcloud compute routes list --filter "network: kubernetes-the-hard-way"


NAME                            NETWORK                  DEST_RANGE     NEXT_HOP                  PRIORITY
default-route-236a40a8bc992b5b  kubernetes-the-hard-way      default-internet-gateway  1000
default-route-df77b1e818a56b30  kubernetes-the-hard-way                            1000
kubernetes-route-10-200-0-0-24  kubernetes-the-hard-way               1000
kubernetes-route-10-200-1-0-24  kubernetes-the-hard-way               1000
kubernetes-route-10-200-2-0-24  kubernetes-the-hard-way               1000

Next: Deploying the DNS Cluster Add-on