Albert Einstein Installing Kubernetes

Introduction

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. However, the steps apply to a majority of Linux machines.

Estimated reading time: 3 minutes

Before installing kubectl

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.28, then you can install either of 1.27, 1.28 or 1.29 versions of kubectl.

The easiest way to install kubectl is to download the latest release from the Kubernetes repository. First, identify whether you are running an x86_64 or arm64 architecture system. If you already know your system’s architecture, skip to the next section.

To identify your computer’s architecture, run:

Example output:

Installing the latest stable version of kubectl

Let’s look at the easiest way to install the latest and stable version of kubectl. We assume you should know if you are running an x86_64 or an arm64 computer.

Download the latest binary

If you are running an x86_64 computer, run:

Alternatively, if you are running an arm64 computer, run:

Installing a specific version of kubectl

If you are looking to install a specific version of kubectl, then you can replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the version you are trying to install. You can get a list of supported versions of Kubernetes and their URLs from downloadkubernetes.com.

Example:

Verify the checksum of the binary (optional)

For x86_64 computers, run:

For arm64 computers, run:

If the binary is valid, and the checksum passes, then the output is:

If it fails, then sha256 exits with a FAILEd message similar to:

Installing kubectl

Run the following command to install kubectl on Ubuntu:

If you do not have root access on your system, you can still use the binary you downloaded by adding execute permissions to it. For example:

Test your installation

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

For example:

Installation using the native package managers

It is also possible to install kubectl on supported platforms with the native package managers such as apt and yum.

Installing kubectl on Ubuntu and other Debian-based systems

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:

Installing kubectl on CentOS and Redhat-based systems

Add the Kubernetes yum 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:

Install kubectl using yum:

References

Read Also:

2 Comments

  1. Great article and right to the point. I am not sure if this is
    actually the best place to ask but do you folks have any thoughts on where to get some professional writers?
    Thx 🙂 Escape rooms hub

Leave a Reply

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