Change:
If you have installed Docker Desktop before, you may need to place your `PATH` entry before the one added by the Docker Desktop installer or remove the Docker Desktop's `kubectl`. {{< /note >}} <del> ### Install with PowerShell from PSGallery If you are on Windows and using the [PowerShell Gallery](https://www.powershellgallery.com/) package manager, you can install and update kubectl with PowerShell. 1. Run the installation commands (making sure to specify a `DownloadLocation`): ```powershell Install-Script -Name 'install-kubectl' -Scope CurrentUser -Force install-kubectl.ps1 [-DownloadLocation <path>] ``` {{< note >}} If you do not specify a `DownloadLocation`, `kubectl` will be installed in the user's `temp` Directory. {{< /note >}} The installer creates `$HOME/.kube` and instructs it to create a config file. 1. Test to ensure the version you installed is up-to-date: ```powershell kubectl version --client ``` {{< note >}} Updating the installation is performed by rerunning the two commands listed in step 1. {{< /note >}} </del> ### Install on Windows using Chocolatey or Scoop 1. To install kubectl on Windows you can use either [Chocolatey](https://chocolatey.org) package manager or [Scoop](https://scoop.sh) command-line installer.

Discussion:
This is a Bug Report Since 3/4 days, we are no longer able to deploy kubectl using the install-kubectl script from PSGallery as described in documentation -- <!--Required Information--Problem: script installation --### OK ##[debug]Using the provider 'PowerShellGet' for searching packages. ##[debug]The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories. ##[debug]Getting the provider object for the PackageManagement Provider 'NuGet'. ##[debug]The specified Location is '' and PackageManagementProvider is 'NuGet'. ##[debug]Searching repository '()?id='install-kubectl'' for ''. ##[debug]Total package yield:'1' for the specified package 'install-kubectl'. ##[debug]The installation scope is specified to be 'CurrentUser'. ##[debug]The specified script will be installed in 'C:WindowsServiceProfilesNetworkServiceDocumentsWindowsPowerShellScripts' and its dependent modules will be installed in 'C:WindowsServiceProfilesNetworkServiceDocumentsWindowsPowerShellModules'. ##[debug]The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'. ##[debug]Downloading script 'install-kubectl' with version '1.7' from the repository ''. ##[debug]Searching repository '()?id='install-kubectl'' for ''. ##[debug]InstallPackage' - name='install-kubectl', version='1.7',destination='C:WindowsServiceProfilesNetworkServiceAppDataLocalTemp' ##[debug]DownloadPackage' - name='install-kubectl', version='1.7',destination='C:WindowsServiceProfilesNetworkServiceAppDataLocalTempinstall-kubectlinstall-', uri='' ##[debug]Downloading ''. ##[debug]Completed downloading ''. ##[debug]Completed downloading 'install-kubectl'. ##[debug]Hash for package 'install-kubectl' does not match hash provided from the server. ##[debug]Script 'install-kubectl' was installed successfully to path install-Script -Name 'install-kubectl' -Scope CurrentUser -Force script execution --### KO ==Getting download link from ==analyzing Downloadlink ==starting Download from using Bitstransfer Cannot validate argument on parameter 'Source'. The argument is null or empty.

Provide an argument that is not null or empty, and then try the command again. detected issue The content of the Uri seems modified few days ago. the script install-kubectl.ps1 is no longer able to get the download link because there is no href matching the executable try { Write-Host -ForegroundColor White "==analyzing Downloadlink" req.Links | where href -Match "").href } catch { Write-Warning "Error Parsing Link" Break } Proposed Solution: Add the necessary href or change the match value <!--Kubernetes Version:--ALL
Honestly, I think that's a bug in the PSGallery script. We can fix this by removing the section The Kubernetes project does not maintain that script. We should remove the link to it. /sig windows
Related, I think is also not something we'd link to based on the .
thanks for mentioning this!
I don't think removing the section is the solution. many customers already have automated kubectl installation using this method according this documentation (including me ^^) Can you put back the "" downloadLink ? req.Links | where href -Match "").href
The documentation for Kubernetes is not a stable API and Kubernetes makes no guarantee about the format of documentation. It's OK if that tool wants to work out a better way to find a download link. In fact, I recommend it. As the Kubernetes project does not maintain that script, we should remove the link to it - it's unhelpful to users to give the impression that that tool is considered secure.
Duplicated by
/triage accepted /priority important-longterm
Change Installation Script Line 29: To: Would resolve this issue. Because download link to is no longer at the previous page.
Package managers are considered out of scope as the Kubernetes org just provides binaries and relies on the community to handle distribution past that. If the documentation here is out of date I think we should remove it to avoid confusion. If someone fixes or creates a new installation script for PSGallery we could easily add it back. I can open a PR - thoughts?
It looks like the was just grabbing a link with from the docs. Definitely not a reliable way to handle installation.

If anyone wants to make a new script it should rely on something like or better yet use to grab or
:+1: If, later, there's a replacement script, it'd be even better for that tool to live in-project. Inside perhaps?
Thanks for taking care of this. would be a good place so it can be updated by sig-windows members