Boot Strap Kubernetes Cluster
Boot Strap Kubernetes Cluster
You must be a root user on all nodes to perform the following tasks:
$ sudo su -
STEP-1:
# vim /etc/modules-load.d/containerd.conf
STEP-2:
# vim /etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
STEP-3
Run following commands to enable docker repository:
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $
(lsb_release -cs) stable"
STEP-4
Add kubernetes repository in all nodes
# apt-get update && apt-get install -y apt-transport-https ca-certificates curl
# echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg]
https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /" | sudo tee
/etc/apt/sources.list.d/kubernetes.list
# curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --
dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
STEP-5
Disable swap:
# vim /etc/fstab (Remove swap mount point from this file)
# sed -i '/swap/d' /etc/fstab
# swapoff -a
STEP-6
Install kubernetes:
# apt-get update
# apt-get install kubelet kubeadm kubectl kubernetes-cni -y (for latest version)
# apt-mark hold kubelet kubeadm kubectl (Secure the packages for accidental
removal)
OR
# export KUBE_VERSION=1.23.0 (use any older version)
# apt-get install -y kubelet=${KUBE_VERSION}-00 kubeadm=${KUBE_VERSION}-00
kubectl=${KUBE_VERSION}-00 kubernetes-cni=0.8.7-00 (for )
# apt-mark hold kubelet kubeadm kubectl (Secure the packages for accidental
removal)
For calico:
----------
# kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
# kubectl get pods -n kube-system
NOTE: Open the calico.yaml file and find the CALICO_IPV4POOL_CIDR environment
variable. Update it to your new CIDR range.
Example CIDR:
- name: CALICO_IPV4POOL_CIDR
value: "20.20.0.0/16"
Troubleshooting (while getting problem running crictl directly on cluster nodes):
# crictl -r unix:///var/run/containerd/containerd.sock ps/pods
# crictl CONTAINER_RUNTIME_ENDPOINT=unix:///var/run/containerd/containerd.sock