Kubernetes Dashborad is not opening

7/28/2019

My Master node ip address is 192.168.56.101. there is no node connected to master yet.

master@kmaster:~$ kubectl get nodes
NAME      STATUS   ROLES    AGE    VERSION
kmaster   Ready    master   125m   v1.15.1
master@kmaster:~$

When i deployed my kubernetes-dashborad using below command, why running IP Address of kubernetes-dashboard-5c8f9556c4-f2jpz is 192.168.189.6 Similarly the other pods has also different IP address.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta1/aio/deploy/recommended.yaml
master@kmaster:~$ kubectl get pods -o wide --all-namespaces
NAMESPACE              NAME                                          READY   STATUS    RESTARTS   AGE    IP               NODE      NOMINATED NODE   READINESS GATES
kube-system            calico-kube-controllers-7bd78b474d-r2bwg      1/1     Running   0          113m   192.168.189.2    kmaster   <none>           <none>
kube-system            calico-node-dsgqt                             1/1     Running   0          113m   192.168.56.101   kmaster   <none>           <none>
kube-system            coredns-5c98db65d4-n2wml                      1/1     Running   0          114m   192.168.189.3    kmaster   <none>           <none>
kube-system            coredns-5c98db65d4-v5qc8                      1/1     Running   0          114m   192.168.189.1    kmaster   <none>           <none>
kube-system            etcd-kmaster                                  1/1     Running   0          114m   192.168.56.101   kmaster   <none>           <none>
kube-system            kube-apiserver-kmaster                        1/1     Running   0          114m   192.168.56.101   kmaster   <none>           <none>
kube-system            kube-controller-manager-kmaster               1/1     Running   0          114m   192.168.56.101   kmaster   <none>           <none>
kube-system            kube-proxy-bgtmr                              1/1     Running   0          114m   192.168.56.101   kmaster   <none>           <none>
kube-system            kube-scheduler-kmaster                        1/1     Running   0          114m   192.168.56.101   kmaster   <none>           <none>
kubernetes-dashboard   kubernetes-dashboard-5c8f9556c4-f2jpz         1/1     Running   0          107m   192.168.189.6    kmaster   <none>           <none>
kubernetes-dashboard   kubernetes-metrics-scraper-86456cdd8f-w45w2   1/1     Running   0          107m   192.168.189.4    kmaster   <none>           <none>
master@kmaster:~$

And also not able to access the kubernetes-dashboard UI. i am using the link http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.

and the link KubeDNS https://192.168.56.101:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy is also not working.

but when trying to access Kubernetes master at https://192.168.56.101:6443 is working.

master@kmaster:~$ kubectl cluster-info
Kubernetes master is running at https://192.168.56.101:6443
KubeDNS is running at https://192.168.56.101:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

Any suggestions.

-- Biswaranjan
kubernetes
kubernetes-dashboard

2 Answers

7/30/2019

If you try to access the dashboard with localhost:8081, you have to run kubectl proxy --port 8081 from your console to setup the proxy between you localhost to the k8s apiserver.

If you want to access dashboard from apiserver directly without the local proxy, try the following url https://192.168.56.101:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy (assuming your service name is kubernetes-dashboard)

You can also run kubectl port-forward svc/kubernetes-dashboard -n kubernetes-dashboard 443, then access the dashboard with https://localhost:443

-- Hang Du
Source: StackOverflow

7/28/2019

Solution (see comments): Don't mix your physical and overlay network ranges.

Accessing the KubeDNS is only possible with DNS as protocol, not HTTP. If you want to query the DNS service you need to kubectl port-forward, not the HTTP (API) proxy.

-- Thomas
Source: StackOverflow