Install Kubernetes - q-uest/notes-doc-k8s-docker-jenkins-all-else GitHub Wiki

k8s cluster installation on ubuntu 20.04

https://github.com/DeekshithSN/cheatsheet/blob/master/installtion_guide_ubuntu.md

Error received:

container runtime is not running

The following needed to be done for the above error received while running "kubeadm init" & "kubeadm join"

rm /etc/containerd/config.toml
systemctl restart containerd
kubeadm init

======== THE BELOW STEPS WERE NOT WORKING...DO NOT USE IT......

Install Kubernetes V.1.24.1 (on Ubuntu 20.04 LTS)

Note: The earlier version of Kubernetes (1.22.x) had had some issues, hence its previous version (1.21) of the tools - kubeadm, kubelet & kubectl were installed. They were installed by explicitly providing the version numbers with the command like -

#apt install -y kubeadm=1.21.0-00 kubelet=1.21.0-00 kubectl=1.21.0-00

Master (As root user)

 apt update -y; apt install -y docker.io ;
 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add ;
 apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" ;
 apt update -y
 apt install -y kubeadm kubelet kubectl
 #hostnamectl set-hostname master 
 kubeadm init --pod-network-cidr=10.244.0.0/16 ;
If you do not want to upgrade certain components, use the below command to do so:
sudo apt-mark hold kubelet kubeadm kubectl
  • Make a non-root user to access kubernetes cluster:

Note: it is a mandatory task, it won’t work from ROOT user (Login as the user with the sudo privs)

 mkdir -p $HOME/.kube;
 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config;
 sudo chown $(id -u):$(id -g) $HOME/.kube/config 

Execute the below:

 kubectl apply -f  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml ;
  • Setting up Nodes (Run as ROOT user)
 apt update -y ; apt install -y docker.io ;
 #sudo hostnamectl set-hostname <NODE_NAME> [do not change node name, when AWS EBS/LB’s are  used) 
 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add;
 sudo apt-add-repository  "deb http://apt.kubernetes.io/ kubernetes-xenial main" ;
 apt update -y;
 apt install -y kubeadm

(Copy the command like the below with the token from the Master and apply)

kubeadm join 172.31.85.86:6443 --token ztr3j4.usf6tyo9h7q9ien2 --discovery-token-ca-cert-hash  sha256:593a00d0100e5687d103c626af730a7709f8d54f28286dfeb18a982438be834f 

Note:

The token provided expires in 24 hours. If you want to add a new node 24 hours after creating the master, you would need to generate a new token on the Master and use that instead. The command for generating a new token -

kubeadm token create
⚠️ **GitHub.com Fallback** ⚠️