How to Install kubectl on Windows (10/11) – Step-by-Step Guide

Rate this post

How to Install kubectl on Windows (10/11) – Step-by-Step Guide

Here’s a complete step-by-step guide to install kubectl on Windows:

Method 1: Using Powershell

Step 1: Open PowerShell as Administrator

  • Search for “PowerShell” in Start menu, right-click and “Run as administrator

Step 2: Download kubectl

curl.exe -LO "https://dl.k8s.io/release/v1.30.0/bin/windows/amd64/kubectl.exe"

Step 3: Verify the download (optional but recommended)

curl.exe -LO "https://dl.k8s.io/v1.30.0/bin/windows/amd64/kubectl.exe.sha256"
CertUtil -hashfile kubectl.exe SHA256
type kubectl.exe.sha256

Compare the two hash values – they should match.

Step 4: Create a directory and move kubectl

mkdir C:\kubectl
move kubectl.exe C:\kubectl\

Step 5: Add kubectl to your PATH

$env:PATH += ";C:\kubectl"

Step 6: Make the PATH change permanent

[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\kubectl", [EnvironmentVariableTarget]::Machine)

Step 7: Verify installation

Close and reopen PowerShell, then run:

kubectl version --client

Method 2: Using Chocolatey

Step 1: Install Chocolatey (if not already installed)

Open PowerShell as Administrator and run:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Step 2: Install kubectl using Chocolatey

choco install kubernetes-cli

Step 3: Verify installation

kubectl version --client

Method 3: Manual Installation

Step 1: Download kubectl binary

  • Go to https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
  • Download the latest release binary
  • Or use this direct link: https://dl.k8s.io/release/v1.30.0/bin/windows/amd64/kubectl.exe

Step 2: Create directory and copy file

  • Create folder C:\kubectl
  • Copy the downloaded kubectl.exe to this folder

Step 3: Add to PATH manually

  • Press Windows + R, type sysdm.cpl, press Enter
  • Click “Environment Variables”
  • Under “System Variables”, find and select “Path”, click “Edit”
  • Click “New” and add C:\kubectl
  • Click “OK” on all dialogs

Step 4: Verify installation

Open a new Command Prompt or PowerShell window:

kubectl version --client

Post-Installation Configuration

Configure kubectl to connect to a cluster

If you have a Kubernetes cluster, you’ll need to configure kubectl:

  1. For cloud providers (AWS EKS, Google GKE, Azure AKS):
    • Follow their specific instructions to get cluster credentials
    • Example for AWS: aws eks update-kubeconfig --region us-west-2 --name my-cluster
  2. For local clusters (minikube, Docker Desktop):
    • These usually configure kubectl automatically
  3. Manual configuration:
    • Place your kubeconfig file in %USERPROFILE%\.kube\config
    • Or set the KUBECONFIG environment variable

Verify cluster connection

kubectl cluster-info
kubectl get nodes

Share On:

Leave a Comment