In this tutorial, we will show you how to install Kubernetes on Ubuntu 22.04 LTS. Are you interested in setting up a robust and scalable container orchestration system on your Ubuntu 22.04 machine? Then you should definitely consider Kubernetes! Kubernetes is an open-source platform designed to automate container deployment, scaling, and management. It is one of the most popular container orchestration systems used in the industry, enabling teams to deploy and manage containerized applications with ease. In this guide, we will walk you through the process of installing and configuring Kubernetes on Ubuntu 22.04, so you can get started with building and managing your own containerized applications. Let’s dive in!
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Kubernetes on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Kubernetes.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Kubernetes on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install wget apt-transport-https gnupg2 software-properties-common
Step 2. Installing Docker.
Kubernetes uses Docker as its container runtime. We need to install Docker before installing Kubernetes. By default, Docker is not available on Ubuntu 22.04 base repository. Now run the following command below to add the Docker repository to the system:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
Next, import the GPG key to your system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
After the repository is enabled, now install the latest version of the Docker package using the below command:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
You can verify that Docker is installed and about the current version:
After successfully installed, enable Docker (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable docker sudo systemctl start docker sudo systemctl status docker
For additional resources on installing and managing Docker, read the post below:
Step 3. Installing Kubernetes on Ubuntu 22.04.
After installing Docker, we can proceed with installing Kubernetes. First, we import the Kubernetes signing key using the following command:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Next, add the Kubernetes repository to the Ubuntu package sources list using the following command:
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
After that, update the package list again and install Kubernetes using the following command below:
sudo apt update sudo apt install kubeadm kubelet kubectl
Step 4. Configure Kubernetes.
After installing Kubernetes, we need to configure it to make it work properly. Now initialize the Kubernetes cluster using the following command:
sudo kubeadm init
Once initialization, Kubernetes will provide a command to add nodes to the cluster. Copy this command and save it for future use. Configure
kubectl to access the Kubernetes cluster using the following commands:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Verify that Kubernetes is working by running the following command:
Congratulations! You have successfully installed Kubernetes. Thanks for using this tutorial for installing the Kubernetes on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Kubernetes website.