How to install Kubernetes on Ubuntu

Many companies are trying to find out how to make their deployment of applications faster. Most developers discovered that Kubernetes could help them solve this issue. It improved the overall deployment of applications by software development teams. There are new technology stacks like DevOps, which categorize Kubernetes as one of the skill sets they look for in an individual. According to InfoWorld, in the United States, individuals with DevOps skills like Kubernetes earn more than $75,000 per year, while in other countries like the UK and the rest of Europe, they pay $50,000 per year. The article will cover how to install Kubernetes on the Ubuntu operating system.

What is Kubernetes

Kubernetes is an open-source tool that uses containers to make applications portable and easy to deploy. It provides good decisions about cluster management and how they can react to the cluster events.

It makes the integration easier with other services, making it easier to monitor applications and provide all the logging services. It works well with other DevOps practices like continuous integration and continuous delivery, making implementing agile practices in a software team easier. Other benefits of using Kubernetes include scaling your applications, reducing production costs by managing the resources, and using auto scaling to meet your needs.

Most of the developers use Docker to create the images. That's why most of the time, Kubernetes works well with Docker. Making containerized applications goes through provisioning, scaling, balancing, networking, and deployment. Kubernetes changed the deployment lifecycle and saved many companies the pains they were going through during the development processes.

Become a Kubernetes Certified professional by learning this Kubernetes Training !

How to install Kubernetes on Ubuntu


  • You should have servers running Ubuntu
  • Ensure that you meet the 2GB of RAM and 2 CPUs.
  • Install Docker for method 2.
  • Be conversant with the sudo commands.

Kubernetes Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

How to install Kubernetes on Ubuntu using MicroK8s

Using MicroK8s gives you the ability to install Kubernetes using one node. They are lightweight and only use single commands to install all the required dependencies and services, and work well with IoT and edge applications.

To install Kubernetes using this method, you have to follow the following steps:

1. First, let us install the MicroK8s on the machine by using the following command

sudo snap install micro k8s --classic

2. Create admin privileges and add users

sudo usermod -a -G microk8s $USER

sudo chown -f -R $USER ~/.kube

3. Update the sessions of the user

su - $USER

4. Confirm the status of the Kubernetes after starting it

micro k8s status --wait-ready

5. Turn on several services you may use by typing the following command

micro k8s enable dashboard dns ingress

6. To get access to all the resources and features, you can type

micro k8s enable --help

7. You can stop all the services using the following command

micro k8s disable ‹name›

8. Now, you can use Kubernetes by typing the following 

micro k8s kubectl get all --all-namespaces

9. Start and access its dashboard by typing

micro k8s dashboard-proxy

If you want to Explore more about Kubernetes? then read our updated article - KubernetesTutorial!

How to install Kubernetes on Ubuntu using Docker

1. Installing docker

In this step, we are going to install Docker. If you already have it installed, you can go to the next step. First, we have to ensure we have an updated package list. Type the following command

sudo apt-get update

Let us now install Docker after the update. Install on both the servers you use.

sudo apt-get install

Confirm the Docker version by typing the following

docker ––version

2. Launching and enabling the Docker

Launch the Docker by typing the following command

sudo systemctl enable docker

Ensure that the Docker is running after the launch

sudo systemctl status docker

If it has not started running, type the following command

sudo systemctl start docker

Repeat the above commands on the different nodes of the server

3. Installing the Kubernetes

Let us now install Kubernetes, and we have to ensure we are using the right software by assigning keys. To assign keys, we use the following command:

curl -s | sudo apt-key add

Most people get errors that curl is not yet installed on their PC. To install curl, we use the following command.

sudo apt-get install curl

Ensure that all the nodes on each software have installed keys.

Subscribe to our youtube channel to get new updates..!

4. Add the Kubernetes software

When installing Kubernetes, most of them don't add themselves into the software repositories, and you have to do it manually.

sudo apt-add-repository "deb kubernetes-xenial main"

Ensure you add repositories for all the nodes.

5. Installation of Kubernetes tools

There are several Kubernetes tools like Kubeadm (Kubernetes Admin) that help in the administration and ensure that developers follow the correct procedures when building clusters. One of the common tools is Kubelet which helps run and start nodes and containers through the command line.

First, let us install the tools. It tekes a few minutes to complete, and try to be patient

sudo apt-get install kubeadm kubelet kubectl

sudo apt-mark hold kubeadm kubelet kubectl

Confirm if the installation is successful by typing the following

kubeadm version

Repeat the processes for all the nodes.

6. Performing the Kubernetes deployment

We have to disable the swap memories of the servers of the project. It helps in preventing Kubernetes from throwing any bad errors along the way.

sudo swapoff –a

Now, assign and give each server node a unique hostname by typing the following command. You have to understand which server you will use as the master node.

sudo hostnamectl set-hostname master-node

Change the hostname using the following command

sudo hostnamectl set-hostname host1.

7. Let us initialize the Kubernetes on the master nodes

Ensure that you are on the master server node and type this command

sudo kubeadm init --pod-network-cidr=

Be keen to check the last entry of the command after processing and copy the entry that appears with a message at the end after kubeadm join. It will be helpful when you want to join the working nodes to the cluster.

Now create the directories for your clusters

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

8.Deploying the pods network to clusters

Pod networks help in communication between different nodes in a cluster. Most of them use flannel networks. Type the following command and wait for a few minutes.

sudo kubectl apply -f

Ensure everything is working perfectly by typing the following command:

kubectl get pods --all-namespaces

Top 30 frequently asked Kubernetes Interview Questions!

9. Join the nodes to the clusters

Type the following command to join the nodes

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

Ensure the numbers in the command match the numbers of your server. Do that for all the nodes and give it a few minutes.

Confirm the status of the nodes and then go to the master server and type the following command

kubectl get nodes

It will give you a list of all the nodes connected to the clusters.

Kubernetes Certification Training

Weekday / Weekend Batches


We have seen two ways to install Kubernetes on Ubuntu. The process is a bit long, and you have to follow the steps keenly to avoid missing some crucial steps. Working with Docker makes the process easier. Kubernetes provides documentation for those who may face issues during installation. After installing Kubernetes, you can use it to install different applications using less time and to automate the whole process. The whole setup makes the deployment of containerized applications successful.

Related Articles:

Find our upcoming Kubernetes Certification Training Online Classes

  • Batch starts on 2nd Jun 2023, Fast Track batch

  • Batch starts on 6th Jun 2023, Weekday batch

  • Batch starts on 10th Jun 2023, Weekend batch

Global Promotional Image


Request for more information

Research Analyst
As a senior Technical Content Writer for HKR Trainings, Gayathri has a good comprehension of the present technical innovations, which incorporates perspectives like Business Intelligence and Analytics. She conveys advanced technical ideas precisely and vividly, as conceivable to the target group, guaranteeing that the content is available to clients. She writes qualitative content in the field of Data Warehousing & ETL, Big Data Analytics, and ERP Tools. Connect me on LinkedIn.

Installation of Kubernetes on Ubuntu FAQ's

Yes, you can run Kubernetes on Ubuntu by installing the kubernetes on both virtual and physical machines.

Yes, you can install kubernetes on linux.

Docker uses kubernetes and the Kubernetes server runs within Docker; it is used for local testing only

Yes, Docker can run without Kubernetes but you need some other kind of container runtime.