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

Step 2: Install Snap Daemon
Snap is not pre-installed on Ubuntu 24.04 minimal installs. Install it if needed:
sudo apt install snapd

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

Step 4: Verify the Installation
sudo kubectl version --client

Uninstall kubectl via Snap
sudo snap remove kubectl

Verify the removal:
sudo kubectl version --client

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

Step 2: Install curl and HTTPS Transport Prerequisites
sudo apt-get install -y apt-transport-https ca-certificates curl

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

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

Step 5: Update and Install kubectl
sudo apt-get update

sudo apt-get install -y kubectl

Step 6: Verify the Installation
kubectl version --client --output=yaml

Uninstall kubectl via APT
sudo apt autoremove kubectl

Verify the removal:
kubectl version --client --output=yaml

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

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

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"

Step 4: Make kubectl Executable
chmod +x kubectl

Verify permissions:
ls -al kubectl

Step 5: Move kubectl to Your PATH
sudo mv kubectl /usr/local/bin

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.