How to install Kubectl on Ubuntu 22.04

June 9th, 2023
How to install Kubectl on Ubuntu 22.04

Do you want to install Kubernetes' command-line tool Kubectl on Ubuntu 22.04 but are unsure how?

This guide will show you how to install Kubectl on Ubuntu 22.04, which will enable you to interact with or execute commands on Kubernetes clusters. By the end of this guide, you should have Kubectl installed on your system.

What is Kubectl?

Before going on to how to install Kubectl on your Ubuntu system, you need to understand what it is and why it is required. Kubectl is a command-line interface (CLI) tool for interacting with Kubernetes clusters. It enables efficient control and management of Kubernetes resources.

With Kubectl, you can deploy applications, inspect and update cluster resources at will, scale deployments, and even troubleshoot issues that surface. Consider Kubectl your bridge, seamlessly connecting you to your Kubernetes cluster, making it easy to issue commands and retrieve information.


  • Basic knowledge of the Linux command-line interface (CLI)
  • Ubuntu 22.04 server

Install Kubectl on Ubuntu 22.04

In this guide, we’ll explore three common ways of installing Kubectl on your Ubuntu 22.04 system: installing the Kubectl binary using curl, the apt package manager, and the snap package manager.

Method 1 - Install Kubectl binary using curl

This method involves manually downloading a release of the Kubectl binary from the official Kubernetes repository using the curl command. This method is suitable if you prefer a specific version of Kubectl or need to install Kubectl on a system where traditional package managers are unavailable.

Step 1 - Download the Kubectl binary

First, you need to download the Kubectl binary from the official Kubernetes release repository. To do this, run the following command in your terminal:

curl -LO "$(curl -L -s"


This will download the latest stable Kubectl binary from the repository. If you would like to download a specific version instead, you can specify the version in the download URL.

Step 2 - Make the Kubectl binary executable

Next, you need to make the downloaded binary executable by running the following command:

chmod +x kubectl


Step 3 - Move Kubectl binary to PATH

Run the following command to move the binary to a directory included in the system's PATH environment variable:

sudo mv kubectl /usr/local/bin


This will make Kubectl accessible from anywhere in the terminal.

Method 2 - Install Kubectl using apt

Another method to install Kubectl on Ubuntu 22.04 is by using the apt package manager. With this method, you can easily update Kubectl and manage its dependencies.

Step 1 - Add Kubernetes repository's GPG (GNU Privacy Guard) key

First, download the GPG key for the Kubernetes repository by running:

curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg


Running this command will download the GPG key, convert it to a binary format, and save it as a GPG keyring file. This keyring file is used to verify the authenticity of the packages, ensuring the genuineness of every package you install from the Kubernetes repository.

Step 2 - Add the Kubernetes repository to your system's sources.list

Next, create a repository entry for the Kubernetes packages by executing the following in the terminal:

echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list


This repository entry will be used by apt to fetch and install packages from the Kubernetes repository.

Step 3 - Update system packages

After adding the repository, update the system packages:

sudo apt update


Step 4 - Install Kubectl using the apt package manager

Now, install Kubectl using apt by running the following command:

sudo apt install kubectl


Method 3 - Install Kubectl using Snap

Snap is another package manager that can be used to install Kubectl on Ubuntu 22.04. This method is suitable if you prefer a simple installation process.

Step 1 - Update system packages

Run the following command to update the system packages:

sudo apt update

Step 2 - Install Kubectl

Next, to install Kubectl using Snap, run the command below:

sudo snap install kubectl --classic


Verify Kubectl Installation

You can verify the Kubectl installation by running the following code in the terminal:

kubectl version --output=yaml


This will display information about the installed Kubectl in YAML format.


You've learned three ways of installing Kubectl on Ubuntu 22.04, and based on your preference, you can decide to use any of them. With Kubectl up and running in your system, you can go on to explore its capabilities by going through its documentation.

Goodness is an expert in technical support, JavaScript programming, and cloud/DevOps engineering. She acquired her skills from studies in computer science and hands-on working experience. Over the years, Goodness has also honed the skills of creating, updating, and improving software documentation, writing instruction guides/manuals and technical articles for the knowledge base, and developing website content. Goodness is an expert in technical writing, DevOps engineering, Linux, Docker, containers, open-source, frontend development, and JavaScript. She also contributes to the documentation of open-source projects like Ansible and ODK-X. Goodness received her B.Sc. in Computer Science from the University of Port Harcourt and resides in Port Harcourt, Nigeria.

Start Building Now

Deploy your new Cloud VPS server in 3 minutes starting from $5.83 / month.

We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: 0cab4b92.684