1

Azure Kubernetes Service created and now to open Kubernetes dashboard, following the steps and getting error:

az : ERROR: Can not find kubectl executable in PATH).

PS C:\Program Files (x86)> az aks install-cli

az : WARNING: Downloading client to C:\Program Files (x86)\kubectl.exe from https://storage.googleapis.com/kubernetes-release/release/v1.10.4/bin/windows/amd64/kubectl.exe
At line:1 char:1
+ az aks install-cli
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (WARNING: Downlo...d64/kubectl.exe:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

WARNING: Please ensure that C:\Program Files (x86) is in your search PATH, so the `kubectl.exe` command can be found.

PS C:\Program Files (x86)> az aks get-credentials --resource-group AKS-RG --name akscls

Merged "akscls" as current context in C:\Users\GK\.kube\config

PS C:\Program Files (x86)> az aks browse --resource-group AKS-RG --name akscls

az : ERROR: Can not find kubectl executable in PATH
At line:1 char:1
+ az aks browse --resource-group AKS-RG --name akscls
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ERROR: Can not ...cutable in PATH:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

enter image description here

Daniele Santi
  • 2,479
  • 1
  • 25
  • 22
Kannan GK
  • 21
  • 1
  • 1
  • 3

3 Answers3

3

You need to install kubectl in your azure cli. Run this command:

az aks install-cli

Then add "C:\Users{user}.azure-kubectl" to your PATH in control panel -> system -> advanced -> environment variables

keving
  • 31
  • 2
0

If kubectl is not found in your PATH, you've likely run into one of two possible issues.

Either:

  • You haven't successfully installed kubectl

or

  • (As the message states) You need to include it in your PATH

Odds are it's the second option, but I'd suggest checking C:\Program Files (x86) just to make sure kubectl.exe is there.

Once you're sure that kubectl is installed, then add C:\Program Files (x86) to your PATH and you should be good.

If you're on Windows 10, you can do that by going to Command Prompt, search for System, click into System. Then on the right left hand side click on Advanced System Settings, you'll get a popup window. At the bottom of that popup window you'll want to click on Environment Variables. You'll get another popup, and in that popup you'll want to look at the list of System Variable and click on the 'Path' variable. That'll bring you to your last popup, where you'll click either new or just click on an empty cell and type in 'C:\Program Files (x86)' to add it to your path.

Here's a gif running through the steps of adding 'C:\Program Files (x86)' to your PATH.

user9975441
  • 195
  • 9
0

For your issue, you want to install kubectl in window, but get the error. And the error that your kubectl path is not in your environment variables. You have two choices.

one is to select a path in environment variables.

  1. First, you download the kubectl.exe from the link the ERROR post: https://storage.googleapis.com/kubernetes-release/release/v1.10.4/bin/windows/amd64/kubectl.exe
  2. Second, you can take a look at your environment PATH use command set Path in prompt or $env:Path in PowerShell. And you can find a appropriate path. As I take the path of CLI:

    C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin

    Then copy kubectl.exe to the path and you will use kubectl directly.

Another is to set your kubectl.exe path "C:\Program Files (x86)" in environment variables. You can use do that in prompt like this:

set Path=%Path%;C:\Program Files (x86)

Charles Xu
  • 136
  • 3