Downloading client to /usr/local/bin/kubectl from https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl
Connection error while attempting to download client ([Errno 13] Permission denied: '/usr/local/bin/kubectl')
I already have kubectl in the directory mentioned.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@glennc Thanks for the feedback! We are currently investigating and will update you shortly.
@glennc you need to run this command from an elevated command window.
Right click on CMD and select "Run as Administrator"
Then the command should go through without issue:

I will close this out but let me know if that does not solve your issue and we can reopen and continue.
should this work from Azure CLI? I'm getting this error from Azure CLI
actually don't worry. i'm an egg.
If you're installing in a linux environment you have to use sudo
sudo az aks install-cli
It worked for me
I am using a Linux environment, but the following command sudo az aks install-cli. Gives me this error sudo: az: command not found.
@dikokob you need to install the Azure CLI before the az commands will work
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
had this on Win (even tho was admin PS), solution is to specify the file as well
bad --install-location C:\tools\azureCLI\
good: --install-location C:\tools\azureCLIkubectl.exe
PS C:\tools\> az aks install-cli --install-location C:\tools\azureCLI
Downloading client to "C:\tools\azureCLI" from "https://storage.googleapis.com/kubernetes-release/release/v1.11.2/bin/windows/amd64/kubectl.exe"
Connection error while attempting to download client ([Errno 13] Permission denied: 'C:\\tools\\azureCLI')
PS C:\tools> az aks install-cli --install-location C:\tools\azureCLI\kubectl.exe
Downloading client to "C:\tools\azureCLI\kubectl.exe" from "https://storage.googleapis.com/kubernetes-release/release/v1.11.2/bin/windows/amd64/kubectl.exe"
Please add "C:\tools\azureCLI" to your search PATH so the `kubectl.exe` can be found. 2 options:
1. Run "set PATH=%PATH%;C:\tools\azureCLI" or "$env:path += 'C:\tools\azureCLI'" for PowerShell. This is good for the current command session.
2. Update system PATH environment variable by following "Control Panel->System->Advanced->Environment Variables", and re-open the command window. You only need to do it once
Its a permission issue. if you are on one of the linux distros (perhaps Windows WSL), check your path.. echo ${PATH}. /usr/local/bin is not writable as your current user. you can either sudo (raise your privilages as above) or try to install it in a different location as described below.
create a directory to house your kubectl binary
$ cd ~; mkdir .mykube;
export the path in your .bashrc by adding the following into ~/.bashrc
export PATH="$HOME/.mykube:$PATH"
check your path again and .mykube should be there (you might need to restart your shell for bashrc to kick in)
$ echo ${PATH}
now install with the following:
$ az aks install-cli --install-location ~/.mykube/kubectl
On Windows10, I had "[Errno 13] Permission denied: "error while running following command.
az aks install-cli --install-location=./kubectl
The workaround was login to PowerShell as Administrator.
Solution:
Downloading client to "./kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.20.0/bin/windows/amd64/kubectl.exe"
Please add "." to your search PATH so the kubectl can be found. 2 options:
1. Run "set PATH=%PATH%;." or "$env:path += '.'" for PowerShell. This is good for the current command session.
2. Update system PATH environment variable by following "Control Panel->System->Advanced->Environment Variables", and re-open the command window. You only need to do it once
Downloading client to "C:\Users\shail\AppData\Local\Temp\tmpvrio6_4p\kubelogin.zip" from "https://github.com/Azure/kubelogin/releases/download/v0.0.7/kubelogin.zip"
Please add "C:\Users\shail.azure-kubelogin" to your search PATH so the kubelogin.exe can be found. 2 options:
1. Run "set PATH=%PATH%;C:\Users\shail.azure-kubelogin" or "$env:path += 'C:\Users\shail.azure-kubelogin'" for PowerShell. This is good for the current command session.
2. Update system PATH environment variable by following "Control Panel->System->Advanced->Environment Variables", and re-open the command window. You only need to do it once
PS C:\Users\shail>
The command worked when logged in to PowerShell as an Administrator.
Most helpful comment
Its a permission issue. if you are on one of the linux distros (perhaps Windows WSL), check your path.. echo ${PATH}. /usr/local/bin is not writable as your current user. you can either sudo (raise your privilages as above) or try to install it in a different location as described below.
create a directory to house your kubectl binary
export the path in your .bashrc by adding the following into ~/.bashrc
export PATH="$HOME/.mykube:$PATH"
check your path again and .mykube should be there (you might need to restart your shell for bashrc to kick in)
now install with the following: