azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az aks browse - aks dashboard not configured to listen on http port 9090

Open graemechristie opened this issue 7 years ago • 13 comments

Describe the bug az aks browse appears to be tunnelling http port 9090 from the kubernetes-dashboard pod to local port 8001, however aks currently appears to be running kubernetes dashboard listening on https port 8443.

To Reproduce Create a new aks cluster <clustername> in resource group <resourcegroup>, then run aks browse -g <resourcegroup> -n <clustername>

Expected behaviour A browser window will open at http://localhost:8001 showing the kubernetes dashboard

Environment summary Verified with az command line version 2.0.32 on windows, linux (wsl) and OSX. kubectl version: 1.15.3 kubernetes version: verified on 1.14.3 and 1.14.6

Additional context az aks browse was working as expected yesterday. I assume that the kubernetes dashboard deployment has been updated on our cluster automatically ... ?

Deploying a new cluster today (v 1.14.6) also sees the kubernetes dashboard running on https port 8443.

[gchristie@mbp ~]$ kubectl describe services kubernetes-dashboard --namespace=kube-system
Name:              kubernetes-dashboard
Namespace:         kube-system
Labels:            addonmanager.kubernetes.io/mode=Reconcile
                   k8s-app=kubernetes-dashboard
                   kubernetes.io/cluster-service=true
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"addonmanager.kubernetes.io/mode":"Reconcile","k8s-app":"kubern...
Selector:          k8s-app=kubernetes-dashboard
Type:              ClusterIP
IP:                10.253.16.34
Port:              <unset>  443/TCP
TargetPort:        https/TCP
Endpoints:         10.254.1.11:8443
Session Affinity:  None
Events:            <none>

kubectl get pods -n kube-system
NAME                                    READY   STATUS    RESTARTS   AGE
coredns-69b5b66fd8-bfg7g                1/1     Running   0          11h
coredns-69b5b66fd8-qt59v                1/1     Running   0          11h
coredns-autoscaler-65d7986c6b-vbq47     1/1     Running   0          21d
kube-proxy-4pmq4                        1/1     Running   0          11h
kube-proxy-w6wkx                        1/1     Running   0          11h
kubernetes-dashboard-674c5dbd96-rctnj   1/1     Running   0          21m
metrics-server-66dbbb67db-scf7s         1/1     Running   2          21d
omsagent-nnlx4                          1/1     Running   0          21d
omsagent-rs-565cfcdf7b-f95fs            1/1     Running   0          21d
omsagent-z5cm9                          1/1     Running   0          21d
tiller-deploy-547959b956-lwxs2          1/1     Running   0          21d
tunnelfront-67dd645dbb-sqm6h            1/1     Running   0          22h```

[gchristie@mbp ~]$ kubectl describe pod kubernetes-dashboard-674c5dbd96-rctn -n kube-system
Name:                 kubernetes-dashboard-674c5dbd96-rctnj
Namespace:            kube-system
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 aks-nodepool1-38285984-vmss000000/172.24.146.4
Start Time:           Tue, 27 Aug 2019 16:13:51 +0800
Labels:               k8s-app=kubernetes-dashboard
                      kubernetes.io/cluster-service=true
                      pod-template-hash=674c5dbd96
Annotations:          <none>
Status:               Running
IP:                   10.254.1.11
Controlled By:        ReplicaSet/kubernetes-dashboard-674c5dbd96
Containers:
  main:
    Container ID:  docker://4d9fd76bcc07fbd7f2cce7f8e2feb243caa25be98d9ad1076d5a9f4903a4219b
    Image:         aksrepos.azurecr.io/mirror/kubernetes-dashboard-amd64:v1.10.1
    Image ID:      docker-pullable://aksrepos.azurecr.io/mirror/kubernetes-dashboard-amd64@sha256:0ae6b69432e78069c5ce2bcde0fe409c5c4d6f0f4d9cd50a17974fea38898747
    Port:          8443/TCP
    Host Port:     0/TCP
    Args:
      --auto-generate-certificates
      --enable-skip-login
    State:          Running
      Started:      Tue, 27 Aug 2019 16:13:53 +0800
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     100m
      memory:  500Mi
    Requests:
      cpu:     100m
      memory:  50Mi
    Liveness:  http-get https://:8443/ delay=30s timeout=30s period=10s #success=1 #failure=3
    Environment:
      KUBERNETES_PORT_443_TCP_ADDR:  npencaks-npencaks-6ee946-a7a806b6.hcp.australiasoutheast.azmk8s.io
      KUBERNETES_PORT:               tcp://npencaks-npencaks-6ee946-a7a806b6.hcp.australiasoutheast.azmk8s.io:443
      KUBERNETES_PORT_443_TCP:       tcp://npencaks-npencaks-6ee946-a7a806b6.hcp.australiasoutheast.azmk8s.io:443
      KUBERNETES_SERVICE_HOST:       npencaks-npencaks-6ee946-a7a806b6.hcp.australiasoutheast.azmk8s.io
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kubernetes-dashboard-token-4h55r (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  kubernetes-dashboard-token-4h55r:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  kubernetes-dashboard-token-4h55r
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  beta.kubernetes.io/os=linux
Tolerations:     CriticalAddonsOnly
                 node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From                                        Message
  ----    ------     ----  ----                                        -------
  Normal  Scheduled  23m   default-scheduler                           Successfully assigned kube-system/kubernetes-dashboard-674c5dbd96-rctnj to aks-nodepool1-38285984-vmss000000
  Normal  Pulled     23m   kubelet, aks-nodepool1-38285984-vmss000000  Container image "aksrepos.azurecr.io/mirror/kubernetes-dashboard-amd64:v1.10.1" already present on machine
  Normal  Created    23m   kubelet, aks-nodepool1-38285984-vmss000000  Created container main
  Normal  Started    23m   kubelet, aks-nodepool1-38285984-vmss000000  Started container main

az aks browse -g <redacted> -n <redacted>
Merged "<redacted>" as current context in /var/folders/nt/f6v0pdx11z18_t5gm8wg1rgmq9rvc2/T/tmprglk94rw
Proxy running on http://127.0.0.1:8001/
Press CTRL+C to close the tunnel...
Forwarding from 127.0.0.1:8001 -> 9090
Forwarding from [::1]:8001 -> 9090
Handling connection for 8001
Handling connection for 8001
E0827 16:38:22.752454   94836 portforward.go:400] an error occurred forwarding 8001 -> 9090: error forwarding port 9090 to pod c9b7c152ed6e885247103ad228972c85b3b735e52e64abbd437fd7875e176f9c, uid : exit status 1: 2019/08/27 08:38:22 socat[96850] E connect(6, AF=2 127.0.0.1:9090, 16): Connection refused
E0827 16:38:22.752456   94836 portforward.go:400] an error occurred forwarding 8001 -> 9090: error forwarding port 9090 to pod c9b7c152ed6e885247103ad228972c85b3b735e52e64abbd437fd7875e176f9c, uid : exit status 1: 2019/08/27 08:38:22 socat[96849] E connect(6, AF=2 127.0.0.1:9090, 16): Connection refused
Handling connection for 8001
E0827 16:38:22.934446   94836 portforward.go:400] an error occurred forwarding 8001 -> 9090: error forwarding port 9090 to pod c9b7c152ed6e885247103ad228972c85b3b735e52e64abbd437fd7875e176f9c, uid : exit status 1: 2019/08/27 08:38:22 socat[96852] E connect(6, AF=2 127.0.0.1:9090, 16): Connection refused
Handling connection for 8001
Handling connection for 8001
E0827 16:38:28.055712   94836 portforward.go:400] an error occurred forwarding 8001 -> 9090: error forwarding port 9090 to pod c9b7c152ed6e885247103ad228972c85b3b735e52e64abbd437fd7875e176f9c, uid : exit status 1: 2019/08/27 08:38:28 socat[97050] E connect(6, AF=2 127.0.0.1:9090, 16): Connection refused

graemechristie avatar Aug 27 '19 08:08 graemechristie

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aks-pm

ghost avatar Aug 27 '19 09:08 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aks-pm

ghost avatar Aug 27 '19 09:08 ghost

We are in region australiasoutheast, if that is of any consequence.

graemechristie avatar Aug 27 '19 09:08 graemechristie

Having this same issue also

moh-abk avatar Aug 27 '19 21:08 moh-abk

Also happening on az [email protected] and az [email protected], this appeared after upgrading to [email protected] in australiasoutheast, but we are getting a cert invalid error.

Capture

For now, our workaround is to use kube proxy directly:

If you haven't, you will first need to merge your az kube credentials into you .kubeconfig file by running:

az aks get-credentials --resource-group RESOURCE_GROUP --name RESOURCE_NAME

Then use this batch script for windows:

@echo off

kubectl config use-context RESOURCE_NAME
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default
kubectl proxy --port 8001
pause

Ironically, so far as a weird side effect, I've found that proxying this way also holds the connection to the dashboard open for longer than 5 minutes for those of you who happen to work in kube all day. 👌

matthewhartstonge avatar Aug 28 '19 01:08 matthewhartstonge

Ironically, so far as a weird side effect, I've found that proxying this way also holds the connection to the dashboard open for longer than 5 minutes for those of you who happen to work in kube all day. 👌

I've noticed this too. I can even disconnect my machine, go home, come back the next day, plug it back into the network and my kubectl proxy connection is still up.

graemechristie avatar Aug 28 '19 03:08 graemechristie

For me, the above script worked great, I did need to add a "start" command before the line launching chrome so it launched in the background and the script continued.

@echo off

kubectl config use-context RESOURCE_NAME
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default
kubectl proxy --port 8001
pause

graemechristie avatar Aug 28 '19 04:08 graemechristie

I just realised I was not running the latest version of the azure cli in my original post. Have updated, and now az aks browse gets the following.

image

S C:\Users\gchristie> az --version                                                                                                                                                                     azure-cli                         2.0.72                                                                                                                                                                
command-modules-nspkg               2.0.3
core                              2.0.72
nspkg                              3.0.4
telemetry                          1.0.3

Extensions:
aks-preview                        0.4.5

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\gchristie\.azure\cliextensions'

Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

graemechristie avatar Aug 28 '19 05:08 graemechristie

This was a temporary issue caused by shifting the dashboard to serve from an HTTPS endpoint (on port 8443) for RBAC clusters prior to the associated CLI changes going out. We've reverted the service side change for now until the updated CLI is released.

seanmck avatar Sep 05 '19 05:09 seanmck

This issue is still happening with kubernetes cluster version 1.16.4. I was able to load k8s dashboard with the workaround mentioned and updated by az CLI. Is this an issue on the service side?

RoyKimYYZ avatar Feb 12 '20 14:02 RoyKimYYZ

same here with both, 1.16.4 and also 1.17.0 @seanmck could you please take a look? thanks!

sebader avatar Feb 19 '20 12:02 sebader

I to managed to resolve this issue by updating my Az CLI (windows) and doing az aks brows ...

RoyKimYYZ avatar Feb 19 '20 14:02 RoyKimYYZ

I also confront the problem too that I can only use AZ cli from powershell only inorder to access :8001 dashboard but in WSL sometime i will not work even though how many time you restart your computer it still didn't work ! The way to fix this problem is using

wsl --shutdown

then restart your wsl with docker integration again and then you can run AZ CLI inside WSL and access dashboard proxy through localhost 😎😎😎

wdrdres3qew5ts21 avatar Jul 24 '20 16:07 wdrdres3qew5ts21