Install Kubectl on Ubuntu with the apt package manager

Install kubectl on Ubuntu using the apt package manager

Estimated reading time: 2 minutes

The kubectl tool is the official Kubernetes CLI. The kubectl command allows you to run commands against your Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, view logs, and more. This article explains the steps to install kubectl on an Ubuntu machine using the apt package manager.

Before you install

Always install a version of kubectl that is within one minor version difference of your cluster. For example, if your Kubernetes cluster is running 1.29, then you can install either of 1.28, 1.29 or 1.30 versions of kubectl.

Installing the latest stable version of kubectl on Ubuntu and other Debian-based systems

Now let’s look at the commands to install the latest stable kubectl version on Ubuntu and other Debian-based systems.

Step 1: Update the apt package index and install the required packages from the Kubernetes apt repository:

Download the public signing key for the Kubernetes package repositories. This key will be the same for all versions so you can ignore the version in the URL.

Add the relevant Kubernetes apt repository, and if you want to install a version other than v1.29, substitute v1.29 with the minor version you want in the following command:

Update the apt package index and install kubectl:

Test your installation of kubectl on Ubuntu

Test your installation by running the version command on Ubuntu. If the installation was successful, you should see an output that prints the kubectl version.

For example:

Before you go

If you want to install the Kubectl tool using the binaries instead of the package manager, check out our quick guide for installing Kubectl to interact with k8s.


Leave a Reply

Your email address will not be published. Required fields are marked *