From ce7eef3210cdaab1776cbfa06561cbf4662f65d5 Mon Sep 17 00:00:00 2001 From: Kelsey Hightower Date: Sun, 11 Sep 2016 07:18:44 -0700 Subject: [PATCH] explain how pods get their subnets --- docs/07-network.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/07-network.md b/docs/07-network.md index c71b762..0d66381 100644 --- a/docs/07-network.md +++ b/docs/07-network.md @@ -2,6 +2,32 @@ 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 router. In GCP each network has a router that can be configured. If this was an on-prem datacenter then ideally you would need to add the routes to your local router. +## Container Subnets + +The IP addresses for each pod will be allocated from the `podCIDR` range assinged to each Kubernetes worker through the node registration process. + +During the worker setup process the following flags were set on the Kubelet to ensure each node obtained a `podCIDR` from the API server: + +``` +--configure-cbr0=true +--reconcile-cidr=true +``` + +The `podCIDR` will be allocated from the cluster cidr range as configured on the Kubernetes Controller Manager with the following flag: + +``` +--cluster-cidr=10.200.0.0/16 +``` + +Based on the above configuration each node will receive a `/24` subnet. For example: + +``` +10.200.0.0/24 +10.200.1.0/24 +10.200.2.0/24 +... +``` + ## 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.