To install kubernetes using flannel, one initially needs to run:
kubeadm init --pod-network-cidr 10.244.0.0/16
Questions are:
This command initializes a Kubernetes control-plane node. Run this command in order to set up the Kubernetes control plane.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With