INSTALLATION
-
Execute the commands below to install the required kubernetes software in all the three machines
-
sudo su
-
sudo apt-get update
-
sudo apt-get install -y apt-transport-https ca-certificates curl
-
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
-
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
-
sudo apt-get install -y kubelet=<Kubernetes_Version> kubeadm=<Kubernetes_Version> kubectl=<Kubernetes_Version>
-
Example: sudo apt-get install -y kubelet=1.19.0-00 kubeadm=1.19.0-00 kubectl=1.19.0-00
-
-
apt update
-
apt install docker.io -y
-
-
Execute the commands below to provision Kubernetes Control plane on the master machine
-
sudo kubeadm init --pod-network-cidr=<CIDR_Range_for_IPAddress>
-
Example: sudo kubeadm init --pod-network-cidr=10.244.0.0/16
-
-
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 command below to list the nodes
-
kubectl get nodes
-
-
Execute the command below to generate a join command to execute on the worker nodes
-
kubeadm token create –print-join-command
-
-
On the Worker machines, execute the join command so that the machines join as workers in the Kubernetes cluster
-
Example: kubeadm join 172.31.2.84:6443 --token fh9lqg.4ko0gz16owx1r8i6 --discovery-token-ca-cert-hash sha256:02fba06cea1124f3639e6aebbcf4f01464bd9dc22512fe50e208be8ed4d56582
-
-
On the master machine, execute the command below to list the nodes
-
kubectl get nodes
-
-
The Kubernetes cluster is up and running for workload deployment