Install kubectl in linux

Spread the love

The command-line tool for communicating with Kubernetes clusters is called Kubectl. It lets you create, remove, and update components, inspect cluster resources, and deploy and manage apps on Kubernetes. As of 2024, this guide offers the most up-to-date instructions for installing Kubectl on different Linux distributions.
Install Kubectl on Ubuntu/Debian

To install Kubectl on Ubuntu or Debian-based distributions, follow these steps:

Update Package List and Install Dependencies:

sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl

Download and Add Google Cloud Public Signing Key:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg

Add Kubernetes APT Repository:

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

Update Package List and Install Kubectl:

sudo apt-get update
sudo apt-get install -y kubectl

Install Kubectl on CentOS/Fedora/RHEL

For CentOS, Fedora, or RHEL-based distributions, use the following steps:

Create Kubernetes YUM Repository:

cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo

Install Kubectl:

sudo yum install -y kubectl

Install Kubectl with Snap on Ubuntu

Ubuntu users can also install Kubectl using the Snap package manager:

Install Kubectl via Snap:

sudo snap install kubectl --classic

Verify Installation:

kubectl version --client

Install Kubectl Binary Using Curl

You can manually download and install the Kubectl binary:

Download the Latest Release:

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

Make the Binary Executable:

chmod +x ./kubectl

Move the Binary to Your Path:

sudo mv ./kubectl /usr/local/bin/kubectl

Verify Installation:

kubectl version --client


You can install Kubectl’s most recent version on your Linux system by using these methods. To ensure that Kubectl is prepared to manage your Kubernetes clusters efficiently, select the approach that best fits your environment and follow the instructions. For the most recent information and recommended practices, always refer to the official Kubernetes documentation.

Leave a Comment