Install Cluster

Now that all nodes fulfill the basic requirements we are ready to setup the cluster. We will use kubeadm here and rely on flannel6 as the network fabric.

All steps described below are also included in the kube-setup-cluster playbook:

ansible-playbook -i inventory kube-setup-cluster.yml -K

It’s surprisingly simple to create a kubernetes cluster with kubeadm:

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

Note: Kubeadm uses the network 10.96.0.0/12 as default but flannel uses 10.244.0.0/16 which we need to pass as option.

The command provides a very detailed explanation what we need to do to get access to your cluster:

To start using your cluster, you need to run the following as a regular user:
mkdir-p$HOME/.kube
cp-i /etc/kubernetes/admin.conf $HOME/.kube/config
chown$(id-u):$(id-g)$HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 10.0.9.88:6443 --token se28o1.ljmh27sev5umdz9x --discovery-token-ca-cert-hash sha256:6c9f49f5fed776e19aabe2b3f8f938c15f3ddb30519d63acded61cd4397e8f85