1

az aks browse works fine on my Mac Mini, but I'm trying to work with it in WSL2 Ubuntu 18.04 with Azure CLI on a Windows 10 machine.

$ az version                      
This command is in preview. It may be changed/removed in a future release.
{
  "azure-cli": "2.1.0",
  "azure-cli-command-modules-nspkg": "2.0.3",
  "azure-cli-core": "2.1.0",
  "azure-cli-nspkg": "3.0.4",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {}
}

Kubernetes 1.14.8 which shouldn't make a difference given it works fine in macOS. Appears to be an issue with WSL2.

The first issue is running:

az aks browse -g <groupname> -n <clustername>

Just brings up the following in az cli:

Proxy running on http://127.0.0.1:8001/
Press CTRL+C to close the tunnel..

It doesn't automatically open the browser from WSL2 like it does in macOS and Linux. So you have to CTRL + Click the http://127.0.0.1:8001 which will open the browser.

The second issue is it only brings up a JSON response with a list of API endpoints that looks like the following:

paths   
0   "/api"
1   "/api/v1"
2   "/apis"
3   "/apis/"
4   "/apis/acme.cert-manager.io"
5   "/apis/acme.cert-manager.io/v1alpha2"
6   "/apis/admissionregistration.k8s.io"
7   "/apis/admissionregistration.k8s.io/v1beta1"
8   "/apis/apiextensions.k8s.io"
9   "/apis/apiextensions.k8s.io/v1beta1"
10  "/apis/apiregistration.k8s.io"
11  "/apis/apiregistration.k8s.io/v1"
12  "/apis/apiregistration.k8s.io/v1beta1"
13  "/apis/apps"
14  "/apis/apps/v1"
....

And doesn't do anything after that.

Followed all of the necessary steps for az login, az aks get-credentials, and RBAC.

What gives?

1

I would expect it to work like az login and open up a new tab in default browser. But somehow it doesn't work like that. I think the fix must come from azure CLI.

Temporarily, For az aks browse you can setup an environment variable on WSL.

export BROWSER="/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"

In this case next when I run az aks browse it will open up the dashboard in new chrome tab.

You can use this variable to use your favorite browser. I would also add this variable to .bashrc or profile to be added on every session.

0

This is a combination of two things. You need the BROWSER variable and there is a bug (as of Sep-2020) where az-cli doesn't detect interactive session correctly (https://github.com/microsoft/WSL2-Linux-Kernel/issues/55)

So you need to modify ~/.bashrc:

export BROWSER="/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"

end then you can run your browser spawning commands with prefix DISPLAY=:0 (sets that environment variable for duration of command; in this case az uses it to determine if the session is interactive and a browser should/could be spawned). So for you:

DISPLAY=:0 az aks browse -g <groupname> -n <clustername>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.