How to Install Kubernetes Using Kubeadm on Ubuntu

Sujata KumariSujata Kumari
1 min read

Prerequisite

  • 2 GB or more of RAM per machine

  • 2 CPUs or more.

Run the below command on both the worker node and the master node

    sudo apt update -y

    sudo apt-get install docker.io -y

    sudo systemctl start docker

    sudo systemctl enable docker

    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 update -y

    sudo apt install kubeadm=1.20.0-00 kubectl=1.20.0-00 kubelet=1.20.0-00 -y

Only on Master Node

sudo su

kubeadm init

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

kubeadm token create --print-join-command

Only Worker Node

sudo su

kubeadm reset pre-flight checks

Now Paste the token generated on the master Node using Join Command and append --v=5 at the end.

Thank you for reading!!

~Sujata Kumari

0
Subscribe to my newsletter

Read articles from Sujata Kumari directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sujata Kumari
Sujata Kumari