Kubernetes cluster From Scratch on AWS Cloud


Prerequisites :-

  • 2 Ubuntu 20.04 LTS Virtual Machines
  • 2 CPU, 4 GB RAM for Master node
  • 1 CPU, 2 GB RAM for Worker Node

Step1: Install Docker engine and kubeadm on Master and Worker Nodes

apt-get update  
apt-get install docker.io -y
service docker restart  
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -  
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >/etc/apt/sources.list.d/kubernetes.list
apt-get update
apt install kubeadm=1.20.0-00 kubectl=1.20.0-00 kubelet=1.20.0-00 -y

Step2: Joining Worker Node to the Master

On Master node run below command

kubeadm init --pod-network-cidr=

Copy the token and use it into the worker node command

Step3: Run kubectl commands as non-root user On Master

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

Step4: Run below commands on master node to Deploy Calico network

curl https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml -O
kubectl apply -f calico.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.49.0/deploy/static/provider/baremetal/deploy.yaml

Run commands mentioned in this doc to https://beginner.academy/kubernetes-shortcuts/ validate Kubernetes cluster & perform deployment verification test.