Understanding kubeadm init command for flannel
Asked Answered
C

1

15

To install kubernetes using flannel, one initially needs to run:

kubeadm init --pod-network-cidr 10.244.0.0/16

Questions are:

  • What is the purpose of "pod-network-cidr"?
  • What's the meaning of such IP "10.244.0.0/16"?
  • How flannel uses this afterwards?
Cherriecherrita answered 26/2, 2018 at 8:57 Comment(0)
C
15

pod-network-cidr is the virtual network that pods will use. That is, any created pod will get an IP inside that range.

The reason of setting this parameter in flannel is because of the following: https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml

Let us take a look at the configuration:

  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }

kube-flannel yml file has 10.244.0.0/16 hardcoded as the network value. If you wanted to use another network (for example, the default that kubeadm uses), you would have to modify the yml to match that networking. In this sense, it is easier to simply start kubeadm with 10.244.0.0/16 so the yml works out of the box.

With that configuration, flannel will configure the overlay in the different nodes accordingly. More details here: https://blog.laputa.io/kubernetes-flannel-networking-6a1cb1f8ec7c

Companion answered 26/2, 2018 at 9:10 Comment(1)
10.244.0.0/16 means 64K addresses. But the recommended number of pods per node is ~110. Why flannel did not choose /25 (128 addresses) or /24 (256 addresses)?Bridges

© 2022 - 2024 — McMap. All rights reserved.