Cannot access to Kubernetes Dashboard

4/12/2019

I have a K8s cluster (1 master, 2 workers) running on 3 vagrant VMs on my computer.

I've installed kubernetes dashboard, like explained here.

All my pods are running correctly:

kubectl get pods -o wide --namespace=kube-system
NAME                                          READY   STATUS    RESTARTS   AGE   IP              NODE                   NOMINATED NODE   READINESS GATES
coredns-fb8b8dccf-n5cpm                       1/1     Running   1          61m   10.244.0.4      kmaster.example.com    <none>           <none>
coredns-fb8b8dccf-qwcr4                       1/1     Running   1          61m   10.244.0.5      kmaster.example.com    <none>           <none>
etcd-kmaster.example.com                      1/1     Running   1          60m   172.42.42.100   kmaster.example.com    <none>           <none>
kube-apiserver-kmaster.example.com            1/1     Running   1          60m   172.42.42.100   kmaster.example.com    <none>           <none>
kube-controller-manager-kmaster.example.com   1/1     Running   1          60m   172.42.42.100   kmaster.example.com    <none>           <none>
kube-flannel-ds-amd64-hcjsm                   1/1     Running   1          61m   172.42.42.100   kmaster.example.com    <none>           <none>
kube-flannel-ds-amd64-klv4f                   1/1     Running   3          56m   172.42.42.102   kworker2.example.com   <none>           <none>
kube-flannel-ds-amd64-lmpnd                   1/1     Running   2          59m   172.42.42.101   kworker1.example.com   <none>           <none>
kube-proxy-86qsw                              1/1     Running   1          59m   10.0.2.15       kworker1.example.com   <none>           <none>
kube-proxy-dp29s                              1/1     Running   1          61m   172.42.42.100   kmaster.example.com    <none>           <none>
kube-proxy-gqqq9                              1/1     Running   1          56m   10.0.2.15       kworker2.example.com   <none>           <none>
kube-scheduler-kmaster.example.com            1/1     Running   1          60m   172.42.42.100   kmaster.example.com    <none>           <none>
kubernetes-dashboard-5f7b999d65-zqbbz         1/1     Running   1          28m   10.244.1.3      kworker1.example.com   <none>           <none>

As you can see the dashboard is in "Running" status.

I also ran kubectl proxy and it's serving on 127.0.0.1:8001.

But when I try to open http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ I have the error:

This site can’t be reached
127.0.0.1 refused to connect.
ERR_CONNECTION_REFUSED

I'm trying to open the dashboard directly on my computer, not inside the vagram VM. Could that be the problem? If yes, how to solve it ? I'm able to ping my VM from my computer without any issue.

Thanks for helping me.

EDIT

Here is the ouput of kubectl get svc -n kube-system

NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
kube-dns               ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   96m
kubernetes-dashboard   NodePort    10.109.230.83   <none>        443:30089/TCP            63m
-- iAmoric
kubernetes
kubernetes-dashboard
vagrant

1 Answer

4/12/2019

Kubernetes dashboard runs only in the cluster as default. You can control it with get svc command:

kubectl get svc -n kube-system

Default type of that service is ClusterIp, to reach from outside of the cluster yo have to change it to NodePort. To change it follow this doc.

-- Yavuz Sert
Source: StackOverflow