HomeInstallationHow to Install Kubernetes on Ubuntu 22.04

How to Install Kubernetes on Ubuntu 22.04

In today’s cloud-focused environment, Kubernetes has become a foundation for managing containerized applications efficiently. By utilizing this, we can access robust tools to seamlessly orchestrate and scale our applications across our infrastructure. This guide will walk you through the straightforward process of installing Kubernetes on Ubuntu 22.04

What is kubernets??

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Initially it was developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). Moreover, it provides a framework for automating the deployment, scaling, and management of containerized applications across a cluster of machines. It abstracts away the underlying infrastructure, allowing developers to focus on building and deploying applications without worrying about the underlying infrastructure details.

Kubernetes uses a declarative model, where you specify the desired state of your applications, and it takes care of maintaining that state. Furthermore, it provides features like automatic scaling, load balancing, self-healing, and rolling updates, making it an ideal platform for deploying and managing modern, microservices-based applications.

Prerequisites

  1. A VPS installed with Ubuntu 22.04
  2. A root account/user account with sudo privileges

Steps To Install Kubernetes

1. Update and Upgrade Ubuntu

Updating and upgrading Ubuntu ensures that your system has the latest package information and security updates. Additionally, this step is crucial to ensure that you have the latest versions of software packages installed on your system.

root@test:~# apt-get update
root@test:~# apt-get upgrade

2. Install Docker

Docker is a containerization platform that allows you to package and distribute applications as containers. Additionally, kubernetes relies on Docker to run containerized applications. Therefore installing Docker ensures that you have the necessary runtime environment for running Kubernetes pods.

To install Docker, we have already discussed the steps in a previous article at https://www.veeble.org/kb/how-to-install-and-use-docker-on-ubuntu/. Following these steps, you can easily install Docker.

To verify docker is successfully installed, run the command below.

root@test:~# docker --version

3. Install Kubernets

1. Install snapd

First you need to install snapd. Snapd is a package manager for snaps, which are self-contained software packages. Notably, Kubernetes can be installed using snapd. Therefore, if snapd is not already installed, you should proceed to install it

root@test:~# apt-get install snapd

2: Install MicroK8s:

MicroK8s is a lightweight Kubernetes distribution that is easy to install and manage. Install MicroK8s using snapd:

root@test:~#snap install microk8s --classic

4: Configure Kubernetes

MicroK8s provides several add-ons that enhance Kubernetes functionality. Enable the necessary add-ons for your setup.

root@test:~# microk8s enable dashboard dns registry istio

Run the following command to check the status of  MicroK8s 

root@test:~# Microk8s status

5: Access Kubernetes Dashboard

If you enabled the dashboard add-on, you can access the dashboard by running:

root@test:~# microk8s dashboard-proxy

Using the following secret token we can login to the dashboard. Copy the token displayed in the output. Then access the dashboard at https://[YOUR IP]:10443.

Next, select the option token and copy the given token. Now, you have successfully signed in to the dashboard .

This should give you a comprehensive guide to installing Kubernetes on Ubuntu 22.04. As it is a powerful container orchestration tool widely used in modern cloud environments, using the above simple steps will allow you to easily install Kubernetes and deploy your applications.

Scroll to Top