From d86caf250fd3c3d8843bfe044da3be3925f344f6 Mon Sep 17 00:00:00 2001 From: Kelsey Hightower Date: Thu, 7 Jul 2016 12:41:32 -0700 Subject: [PATCH] update docs --- docs/network.md | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/docs/network.md b/docs/network.md index 5098d23..0628ac8 100644 --- a/docs/network.md +++ b/docs/network.md @@ -1,20 +1,58 @@ # Managing the Container Network Routes +Now that each worker node is online we need to add routes to make sure that Pods running on different machines can talk to each other. In this lab we are not going to provision any overlay networks and instead rely on layer 3 networking. That means we need to add routes to our route. In GCP each network has a route that can be configured. If this was an on-prem datacenter then ideally you would need to add the routes to your router. + +After completing this lab you will have the following router entries: + +``` +$ gcloud compute routes list +``` +``` +NAME NETWORK DEST_RANGE NEXT_HOP PRIORITY +default-route-10-200-0-0-24 default 10.200.0.0/24 10.240.0.30 1000 +default-route-10-200-1-0-24 default 10.200.1.0/24 10.240.0.31 1000 +default-route-10-200-2-0-24 default 10.200.2.0/24 10.240.0.32 1000 +``` + ## Get the routing Table +The first thing we need to do is gather the information required to populate the router table. We need the Internal IP address and Pod Subnet for each of the worker nodes. + +``` +gcloud compute ssh controller0 +``` + +Use `kubectl` to print the `InternalIP` and `podCIDR` for each worker node: + ``` kubectl get nodes \ ---output=jsonpath='{range .items[*]}{.name} {.status.addaddress} {.spec.podCIDR} {"\n"}{end}' + --output=jsonpath='{range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address} {.spec.podCIDR} {"\n"}{end}' ``` +Output: + ``` -10.240.0.30 10.200.0.0/24 +10.240.0.30 10.200.0.0/24 +10.240.0.31 10.200.1.0/24 +10.240.0.32 10.200.2.0/24 ``` -### Add the routes +Use `gcloud` to add the routes to GCP: ``` gcloud compute routes create default-route-10-200-0-0-24 \ --next-hop-address 10.240.0.30 \ --destination-range 10.200.0.0/24 +``` + +``` +gcloud compute routes create default-route-10-200-1-0-24 \ + --next-hop-address 10.240.0.31 \ + --destination-range 10.200.1.0/24 +``` + +``` +gcloud compute routes create default-route-10-200-2-0-24 \ + --next-hop-address 10.240.0.32 \ + --destination-range 10.200.2.0/24 ``` \ No newline at end of file