Kubernetes is an open-source platform for managing containers such as Docker. Is a management system that provides a platform for deployment automation. With Kubernetes, you can freely make use of the hybrid, on-premise, and public cloud infrastructure to run deployment tasks of your project.

And Docker lets you create containers for a pre-configured image and application. Kubernetes provides the next step, allowing you to balance loads between containers and run multiple containers across multiple systems.

This guidebook will walk you through How to Install Kubernetes on Ubuntu 20.04.


  • 2 or more Linux servers running Ubuntu 20.04
  • root privileges
  • 3.75 GB or more of Ram - for better performance, use 6 GB
  • 2 CPUs or more
  • Full network connectivity between all machines in the cluster (public or private network is fine)
  • Unique hostname, MAC address, and product_uuid for every node.
  • Certain ports are open on your machines.
  • Swap disabled. You MUST disable swap for the kubelet to work properly.


Install a Docker container and then install Kubernetes with two nodes on Ubuntu 20.04

  • How to install Docker
  • How to install Kubernetes
  • How to configure a master and two worker node
  • How to join a worker node to a Kubernetes cluster

So, let's start the installation

Step 1 - Update Ubuntu

Always recommended updating the system packages.

So let's go to the command:


sudo apt update

Then type:


sudo apt upgrade

Step 2 - Install Docker

Kubernetes requires an existing Docker installation.

Install Docker with the command:


sudo apt install docker.io

Repeat the process on each server that will act as a node.

Check the installation (and version) by entering the following:


docker ––version

Step 3 - Start and Enable Docker

Set Docker to launch at boot by entering the following:


sudo systemctl enable docker


sudo systemctl start docker

Verify Docker is running:


sudo systemctl status docker

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-10-20 13:53:02 -03; 2h 54min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 2282 (dockerd)
      Tasks: 21
     Memory: 146.3M
     CGroup: /system.slice/docker.service
             └─2282 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

To start Docker if it’s not running:


sudo systemctl start docker

Repeat on all the other nodes.

Step 4 - Install Kubernetes

As we are downloading Kubernetes from a non-standard repository, it is essential to ensure that the software is authentic. This is done by adding a subscription key.

Enter the following to add a signing key in you on Ubuntu:


curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add

Then repeat the previous command to install the signing keys.

Repeat for each server node.

Step 5 - Add Software Repositories

Kubernetes is not included in the default repositories. To add them, enter the following:


sudo apt-add-repository "deb http://apt.kubernetes.io/kubernetes-xenial main"

Repeat for each server node.

Step 6 - Kubernetes Installation Tools

Kubernetes Admin or Kubeadm is a tool that helps initialize a cluster. Its fast-track setup by using community-sourced best practices. Kubelet is the work package, which runs on every node and starts containers. The tool gives you command-line access to clusters.

Install Kubernetes tools with the command:


sudo apt-get install kubeadm kubelet kubectl


sudo apt-mark hold kubeadm kubelet kubectl

Allow the process to complete.

Verify the installation with:


kubeadm version

Repeat for each server node.

Step 7 - Kubernetes Deployment

Begin Kubernetes Deployment

Start by disabling the swap memory on each server:


sudo swapoff –a

Step 8 - Assign Unique Hostname for Each Server Node

Decide which server to set as the master node. Then enter the command:


sudo hostnamectl set-hostname master-node

Next, set a worker node hostname by entering the following on the worker server:


sudo hostnamectl set-hostname w1

If you have additional worker nodes, use this process to set a unique hostname on each.

Step 9 - Initialize Kubernetes on Master Node

Switch to the master server node, and enter the following:


sudo kubeadm init --pod-network-cidr=

Once this command finishes, it will display a kubeadm join message at the end. Make a note of the whole entry. This will be used to join the worker nodes to the cluster.

Next, enter the following to create a directory for the cluster:

kubernetes-master:~$ kubernetes-master:~$ kubernetes-master:~$

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

Step 10 - Deploy Pod Network to Cluster

A Pod Network is a way to allow communication between different nodes in the cluster. This tutorial uses the flannel virtual network.

Enter the following:


sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Allow the process to complete.

Verify that everything is running and communicating:


kubectl get pods --all-namespaces

Step 11 - Join the Worker Node to Cluster

As indicated in Step 7, you can enter the kubeadm join command on each worker node to connect it to the cluster.

Switch to the w1 system and enter the command you noted from Step 8:


kubeadm join --discovery-token abcdef.1234567890abcdef --discovery token-ca-cert-hash sha256:1234..cdef

Replace the alphanumeric codes with those from your master server. Repeat for each worker node on the cluster. Wait a few minutes; then you can check the status of the nodes.

Switch to the master server, and enter:


kubectl get nodes

The system should display the worker nodes that you joined to the cluster.

Node Hostname IP Address vCPUs RAM (GB) OS
Master master.letscloud.io 2 3.75 Ubuntu 20.04
W1 w1.letscloud.io 2 3.75 Ubuntu 20.04
W2 w2.letscloud.io 2 3.75 Ubuntu 20.04

Quick Tip

For beginners who still have no experience of deploying multiple containers, Minikube is a great way to start.


After following the steps mentioned in this article carefully, you should now have Kubernetes installed on Ubuntu. Kubernetes allows you to launch and manage Docker containers across multiple servers in the pod.

In this article, we have explained the installation of the Kubernetes container management system on Ubuntu 20.04. Kubernetes has a lot of functionality and features to offer. The Kubernetes Official Documentation is the best place to learn.

If you have any questions about installing and configuring Kubernetes on Ubuntu, please contact us in the comments.