Setup Kubernetes Cluster in 15 minutes | 2021

0.kubernetes overview

In the Previous Blog Post, I have given a brief of What is Kubernetes and the Architecture of Kubernets. If you have not seen then visit Kubernetes Basic . In this blog, I will show you how you can setup Kubernetes Cluster in 15 minutes. we are going to set up master and worker nodes. You can use AWS t2-medium instance for the Master node since the minimum requirement to create a Master Node is 2 CPU & 4 GB RAM. For Worker Node you can go with t2-micro. But in this Blog, I have chosen all the nodes as t2-micro.


  • Setup a Master Node and Worker Node. You can view all the node in master node.

Before you begin Setup Instance in  AWS

  1. Login to AWS Account
  2. Launch 3 Instance(Ubuntu – 16.04 ,t2 Medium) : 1-Master , 2-Worker Node
setup kubernetes cluster

Setup Kubernetes Cluster

Configure in Both Master and Worker Node

sudo su
apt-get update

setup kubernetes cluster
apt-get install apt-transport-https
setup kubernetes cluster

This HTTP is needed for intracluster communication(Particularly from Master to Worker Node)

In Ubuntu 16.04 Docker is already available. You just need to install using the below command

apt install -y
setup kubernetes cluster

To check if docker is installed or not run ‘docker –version’

Screenshot 2021 08 13 at 9.14.49 AM
systemctl start docker

systemctl enable docker
setup kubernetes cluster

Setup Open GPG Key. This is required for intracluster communication. It will be added to the source key on this node i.e. when K8S send signed info to our host, it is going to accept that information because this open GPG key is present in the source key.

Install GPG key

curl | sudo apt-key --keyring /usr/share/keyrings/ add -

Open Kubernetes list and past deb command

viĀ  /etc/apt/sources.list.d/kubernetes.list
deb kubernetes-xenial main

After inserting kubernetes-xenial in kubernetes.list update the repository again.

apt-get update

If on apt-get update you get ERROR ( NO_PUBKEY FEEAA12694307EA071  NO_PUBKEY 8B574C5C2D2836F4BE) then import using 

sudo apt-key adv --keyserver --recv-keys <KEY>
sudo apt-key adv --keyserver --recv-keys FEEAA12694307EA071
sudo apt-key adv --keyserver --recv-keys 8B574C5C2D2836F4BE

and then run apt-get update

setup kubernetes cluster
apt-get install -y kubelet kubeadm kubectl kubernetes-cni

Configure Master Node

kubeadm init

If you get an error then check kubelet status is running or not. If not then

Make sure you are logged in as root and execute the below two commands :

echo '{"exec-opts": ["native.cgroupdriver=systemd"]}' >> /etc/docker/daemon.json
systemctl restart docker
kubeadm reset

When you run kubeadm init then you will given set of command to run for example

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

You will be even given the join command that you need to run on the worker node to join the master node. Please run the join command when you have configured the flannel.

Configure Flannel

kubectl apply -f



e.g- kubeadm join –token kl9fhu.co2n90v3rxtqllrs –discovery-token-ca-cert-hash sha256:b0f8003d23dbf445e0132a53d7aa1922bdef8d553d9eca06e65c928322b3e7c0

Open 6443 Port so that master node can connect

If you are getting error failed with error: Get “http://localhost:10248/healthz” then run:

echo '{"exec-opts": ["native.cgroupdriver=systemd"]}' >> /etc/docker/daemon.json 
systemctl restart docker


kubectl get nodes
Screenshot 2021 08 13 at 3.46.06 PM

That’s all in the Blog. Hope you like it. Don’t forget to subscribe to the latest blog.

Install Kubectl:

Leave a comment

Your email address will not be published.