Kathrine Stack
Kathrine Stack

Reputation: 319

Azure CLI aks install cli permission denied and sudo does not work

I'm trying to run az aks install-cli but I get an error that says

Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl"
Connection error while attempting to download client ([Errno 13] Permission denied: '/usr/local/bin/kubectl')

If I use sudo I get:

bash: sudo: command not found

Not sure how to elevate permissions other than using sudo

Upvotes: 7

Views: 17250

Answers (4)

Kishore CNCF
Kishore CNCF

Reputation: 1

Since kubectl is already installed, you don't have to do the az aks install-cli, probably your next step is get the certificate set up into kube config with the following command

az aks get-credentials --name <cluster name> --resource-group <resource group name> Once .kube/config file is generated, you can start interacting with the cluster.

Upvotes: 0

Andy T
Andy T

Reputation: 1377

I still get error when I run it in Azure Portal Cloud Shell Powershell window - enter image description here

but as it is specified above kubectl is already installed. I ran kubectl commands directly after switching to BASH - it ran fine. enter image description here

Upvotes: 1

Charles Xu
Charles Xu

Reputation: 31454

You do not need to install the kubectl for AKS if you use the Azure Cloud Shell, that's a default tool installed in it. See all the default tools installed in Azure Cloud Shell.

So you should take a look at the list if you want to install a tool in the Azure Cloud Shell.

And permissions are set as regular users without sudo access. Any installation outside your $Home directory is not persisted. So you cannot execute the sudo command in it.

Upvotes: 9

Mo Ziauddin
Mo Ziauddin

Reputation: 410

Apparently, this is expected. It tries to install it in /usr/local/bin which isnt user writable.

You need to either use: sudo aks kubernetes install-cli OR use the --install-location to install to another location.

There is an issue similar to this reported on azure-cli repo: https://github.com/Azure/azure-cli/issues/2558

Upvotes: 1

Related Questions