Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding kubeadm init command for flannel

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?
like image 369
testTester Avatar asked Feb 26 '18 08:02

testTester


People also ask

What is Kubeadm init command?

This command initializes a Kubernetes control-plane node. Run this command in order to set up the Kubernetes control plane.

How does flannel work in Kubernetes?

Flannel runs a simple overlay network across all the nodes of the Kubernetes cluster. It provides networking at Layer 3, the Network Layer of the OSI networking model. Flannel supports VXLAN as its default backend, although you can also configure it to use UDP and host-gw.

What is the Kubeadm command used for?

Kubeadm is a tool built to provide kubeadm init and kubeadm join as best-practice "fast paths" for creating Kubernetes clusters. kubeadm performs the actions necessary to get a minimum viable cluster up and running. By design, it cares only about bootstrapping, not about provisioning machines.


1 Answers

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

like image 83
Javier Salmeron Avatar answered Sep 21 '22 13:09

Javier Salmeron