In this blog, post I will show you how to install the Kubernetes Kubectl command-line tool on Windows Server 2019.
If you are running Docker Desktop, Docker already configures Kubectl on your machine and made sure it is installed and updated.
Docker Desktop also adds the Kubectl.exe command to the PowerShell default path so when you type Kubectl Windows already knows where it is.
On a Windows Server 2019 and 2016, we need to do it manually and I will show you how.
To install the Kubectl command-line tool, I use PowerShell and runs the command below:
Install-Script -Name install-kubectl -Scope CurrentUser -Force
The command has downloaded a PS script which I will run next:
Add Command Path
To add the Kubectl command to the default command path, I will note down the path below which is:
To add the path, I open the System Properties from the Control Panel System option.
From the Advanced Tab, I click on Environment Variables…
Click on Path, Select Edit and add the kubectl path noted down
Below you can see the end result
Now when I open PowerShell and type kubectl Windows finds it.