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 kubectlmacOS (Homebrew):
brew install kubectlWindows (Chocolatey):
choco install kubernetes-cliStep 2: Download kubectl directly (Linux)
- 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"- Make it executable and move to PATH:
chmod +x kubectl
sudo mv kubectl /usr/local/bin/- Verify:
kubectl version --clientStep 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 --clientBuilt by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro