Kubernetes is a tool to orchestrate multiple different containers at the same time. Kubernetes provides a very rich set of abstractions, effectively software primitives, that automate functions for compute, storage, networking, and other infrastructure services, yet deceptively simple to set up initially.
kubectl is the command line interface of Kubernetes, You can use kubectl to manage cluster resources, deploy and inspect applications. kubectl is available on most major platforms, including Linux, macOS, and Windows.
In this article, we will show you how to install kubectl on Ubuntu. The guide is applicable to older versions of Ubuntu and many as well as Linux distros based on Ubuntu, such as Linux Mint or Pop! OS.

Update all packages
Before installing any new package or application, it is recommended that you update your system. To do this, run the commands below which invoke apt
package manager to fetch a fresh package list from Ubuntu repository.
sudo apt update
Install kubectl on Ubuntu using snap
Snap is the new way of installing software on Linux systems. Snap was introduced by Canonical, the reputable company behind Ubuntu. With snaps, you can install all of an app’s dependencies with a single command, and updates are automatic and resilient. Plus, apps run in their own isolated sandbox, thus minimizing security risks.
If your Ubuntu version is higher than 16.04, snap
is already installed and ready to go, you don’t have to do anything else. For those who don’t want to check OS version, Ubuntu 16.04, 18.04 and 20.04 LTS has snap
built-in. But in case you’re running legacy Ubuntu versions, as well as Ubuntu flavours that don’t include snap by default, snap can be installed from the Ubuntu Software Centre by searching for snapd or running the following command.
sudo apt install snapd
If you are installing snap for the first time, it is advised to install the core
package to make sure that all the basic features of snap
works fine. In order to do that, run the following command in any terminal window :
sudo snap install core
Now that snap
is properly set up, all you need to do to install kubectl is running the command below :
sudo snap install kubectl --classic
The --classic
flag instruct snap to install kubectl as a “classic” confinement. Binaries within a snap installed with classic confinement will load the depencies from the host system, not the core snap image, so it won’t be portable between distros and versions of distros.
Once the installation completes, you can confirm that the system recognizes kubectl by running kubectl version

Install kubectl using apt
As an alternative to snap
, you can add the Kubernetes repository into Ubuntu, and then use apt
to fetch the up-to-date version of kubectl
from Google iself.
Step 1 : Install curl
on your system by running the commands below
sudo apt update
sudo apt upgrade
sudo apt-get install -y apt-transport-https ca-certificates curl
Code language: JavaScript (javascript)
Step 2 : Install public key signed by Google and add the Kubernetes repository to your system by running the commands below.
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
Code language: PHP (php)
Step 3 : Update apt
package index with the new repository and install kubectl by running :
sudo apt-get update
sudo apt-get install -y kubectl
Code language: JavaScript (javascript)
Install kubectl binary directly
If you’re in a hurry and just wants to install kubectl as fast as you possible, you can download kubectl and install it directly on your system. You won’t be able to update it automatically in the future, but on the other side, you can fetch any specific kubectl version you want.
Before getting further, ensure that you already had curl
installed on your system. If you don’t, run the following commands to install curl
and its depencies.
sudo apt-get install -y apt-transport-https ca-certificates curl
Code language: JavaScript (javascript)
In order to install the latest version of kubectl, you can sequentially run the following commands :
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
Code language: JavaScript (javascript)
You can replace the $(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
part in the commands above with a specific version to install that version instead of the latest one. For example, in order to install version 1.7.5, run:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.7.5/bin/linux/amd64/kubectl
Code language: JavaScript (javascript)
We hope that the information above helped you successfully install kubectl on your Ubuntu system. We’ve also covered other software installation for Linux, such as How to install Chromium browser in Debian, How to install CMake, Airflow and ADB/fastboot on Ubuntu, in case you’re interested. If you have any suggestion, please feel free to leave a comment below.