Skip to content
kubectl: command not found

kubectl: command not found

DodaTech 2 min read

The “kubectl: command not found” error means the Kubernetes CLI is not installed or not in your PATH, so you cannot interact with any Kubernetes cluster.

What It Means

Your shell cannot find the kubectl binary in any directory listed in the PATH environment variable. Kubectl must be installed as a standalone binary or accessed through containerized tools.

Why It Happens

  • Kubectl was never installed on your system.
  • The installation was incomplete or the binary is not executable.
  • The kubectl binary is in a directory not included in your PATH.
  • You’re using a minimal container image or a fresh VM.
  • You installed kubectl for a different user account.

How to Fix It

Step 1: Install kubectl via package manager

Ubuntu / Debian:

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

macOS (Homebrew):

brew install kubectl

Windows (Chocolatey):

choco install kubernetes-cli

Step 2: Download kubectl directly (Linux)

  1. Download 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"
  1. Make it executable and move to PATH:
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
  1. Verify:
kubectl version --client

Step 3: Use kubectl via Docker

If you don’t want to install kubectl directly:

alias kubectl="docker run --rm -it -v $HOME/.kube:/root/.kube bitnami/kubectl:latest"

Step 4: Verify kubectl is in PATH

which kubectl || echo "kubectl not in PATH"
kubectl version --client
How do I install a specific version of kubectl?
Replace the version in the download URL: curl -LO "https://dl.k8s.io/release/v1.29.0/bin/linux/amd64/kubectl". List available versions at https://dl.k8s.io/release/. Match your kubectl version to within one minor version of your cluster for compatibility.
What if I get 'Permission denied' when running kubectl?
Run chmod +x /usr/local/bin/kubectl to make the binary executable. If you installed via a package manager, reinstall with sudo. You can also run kubectl from the current directory with ./kubectl if you don’t have sudo access.
Can I use kubectl without installing anything?
Yes — use the Kubernetes dashboard web UI, or run kubectl from a container as shown above. Cloud providers like Google Cloud also offer a built-in shell with kubectl preinstalled through their console.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro