Kubectl is a command-line tool that lets developers and administrators deploy, monitor, manage, and scale applications in a Kubernetes containerized environment. Having kubectl installed on Ubuntu lets DevOps engineers communicate with different clusters using single-line commands.

Quick answer

You can install kubectl on Ubuntu 24.04 with Snap, APT, or curl. After installation, run kubectl version --client to confirm the client works before adding a kubeconfig file or connecting to a cluster.

How to Install kubectl on Ubuntu 24.04

Method Command Auto-updates Notes
Snap sudo snap install kubectl –classic Yes (snap refresh) Simplest install
APT (Kubernetes repo) sudo apt-get install -y kubectl Yes (apt upgrade) Full APT integration
curl curl -LO + chmod + mv No Pinned to exact version

Method 1: Install kubectl on Ubuntu 24.04 Using Snap

Step 1: Update Repository

sudo apt update
Terminal output of sudo apt update on Ubuntu 24.04

Step 2: Install Snap Daemon

Snap is not pre-installed on Ubuntu 24.04 minimal installs. Install it if needed:

sudo apt install snapd
Terminal output of sudo apt install snapd on Ubuntu 24.04

Step 3: Install kubectl

The --classic flag gives kubectl full system access required to read kubeconfig files and manage clusters:

sudo snap install kubectl --classic
Terminal output of sudo snap install kubectl --classic on Ubuntu 24.04

Step 4: Verify the Installation

sudo kubectl version --client
Terminal output of kubectl version --client on Ubuntu 24.04

Uninstall kubectl via Snap

sudo snap remove kubectl
Terminal output of snap remove kubectl on Ubuntu 24.04

Verify the removal:

sudo kubectl version --client
Terminal showing kubectl command not found after removal on Ubuntu 24.04

Method 2: Install kubectl on Ubuntu 24.04 Using APT

This method adds the official Kubernetes APT repository so kubectl receives updates through standard apt upgrade.

Step 1: Update APT Repository

sudo apt-get update
Terminal output of sudo apt-get update on Ubuntu 24.04

Step 2: Install curl and HTTPS Transport Prerequisites

sudo apt-get install -y apt-transport-https ca-certificates curl
Terminal output of installing apt-transport-https ca-certificates and curl on Ubuntu 24.04

Step 3: Download the Kubernetes GPG Key

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
Terminal output of curl downloading Kubernetes GPG signing key on Ubuntu 24.04

Step 4: Add the Kubernetes Repository

echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
Terminal output of echo command adding Kubernetes APT repository on Ubuntu 24.04

Step 5: Update and Install kubectl

sudo apt-get update
Terminal output of sudo apt-get update after adding Kubernetes repo on Ubuntu 24.04
sudo apt-get install -y kubectl
Terminal output of sudo apt-get install kubectl on Ubuntu 24.04

Step 6: Verify the Installation

kubectl version --client --output=yaml
Terminal output of kubectl version --client --output=yaml on Ubuntu 24.04

Uninstall kubectl via APT

sudo apt autoremove kubectl
Terminal output of sudo apt autoremove kubectl on Ubuntu 24.04

Verify the removal:

kubectl version --client --output=yaml
Terminal showing kubectl command not found after apt removal on Ubuntu 24.04

Method 3: Install kubectl on Ubuntu 24.04 Using curl

The curl method downloads a specific kubectl binary directly, without adding a package repository. This is useful when you need to pin kubectl to a specific version.

Step 1: Install curl

sudo apt install curl
Terminal output of sudo apt install curl on Ubuntu 24.04

Step 2: Check System Architecture

Use lscpu to confirm your architecture. Download the amd64 binary for x86_64 systems, or substitute arm64 for ARM:

Terminal showing system architecture information on Ubuntu 24.04

Step 3: Download kubectl

The following command always downloads the latest stable release:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Terminal output of curl downloading kubectl binary on Ubuntu 24.04

Step 4: Make kubectl Executable

chmod +x kubectl
Terminal output of chmod +x kubectl on Ubuntu 24.04

Verify permissions:

ls -al kubectl
Terminal output of ls -al kubectl showing file permissions on Ubuntu 24.04

Step 5: Move kubectl to Your PATH

sudo mv kubectl /usr/local/bin
Terminal output of sudo mv kubectl to /usr/local/bin on Ubuntu 24.04

Before using kubectl

Installing kubectl only gives you the Kubernetes command-line client. To manage real workloads, you still need access to a Kubernetes cluster and a valid kubeconfig file.

Try to keep kubectl close to the Kubernetes cluster version you manage. A small version difference is usually fine, but very old clients can cause confusing errors when talking to newer clusters.

Related Ubuntu 24.04 guides