Bring up a Sample K8s cluster with Containerd
No Docker
Setup
We have one master and (optional) workers.
Make all firewall ports Open. You don’t want to get stuck here.
Main Reference https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
Step 1- Install Containerd in all 4 Nodes — No docker needed
Follow this in all your 4 nodes https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd
We will configure systemd cgroups driver for containerd.
Note that there is a bug with the /etc/containerd/config.toml
containerd-config-bug
It may be apparent in the next steps when you try to do kubeadm init
or in the worker nodes kubeadm join
.
The workaround is to delete this file and restart the containerd service and after that the kubelet service.
rm /etc/containerd/config.toml
systemctl restart containerd
systemctl restart kubelet
Step 2 Install kubelet,kubeadm and kubectl in all nodes
Install ‘kubelet kubeadm kubectl
in all 4 nodes as is written here
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
Step 3 — In Master — do Kubeadm init and CNI plugin
Before that
- Since we are using containerd we need to specify that
- Since we are using Flannel , we need a specific pod cidr to be specified
Create a config.yaml with the following
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
networking:
podSubnet: "10.244.0.0/16" # --pod-network-cidr
In Master Node
kubeadm init --config config.yaml
Note — If you are getting an error as specified in the issue containerd-config-bug, do the workaround specified
On success, you should get
Your Kubernetes control-plane has initialized successfully!To start using your cluster, you need to run the following as a regular user:
Do as it is printed
Next is POD network — we will use Flannel
- Apply Container Networking in Master node
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Step 4 — In all workers do kubeadm join
Note — If you are getting an error as specified in the issue containerd-config-bug, do the workaround specified
In case you find problems with node not joiining and gettting the error CNI Network not available do the workaround
Step 5 — Copy kubeconfig to your local machine
Your cluster should be up. Copy the kubeconfig from the master node (cat ~/.kube/config ) to your lapop
Since we have not configured SSL set the insercure option via kubectl in your laptop for easy working.
kubectl config set-cluster kubernetes-green --insecure-skip-tls-verify=true
That’s it.