11

i followed this guide link to install a kubernetes cluster and i have no error, but i can't access kubernetes-Dashboard

I did kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml and when i go to https://192.168.11.20/ui is nothing there

how can i access the dashboard?

some additional information

[root@kubeMaster ~]# kubectl get nodes
NAME        STATUS    AGE
kubenode1   Ready     6h
kubenode2   Ready     6h

[root@kubeMaster ~]# kubectl get pods
No resources found.

[root@kubeMaster ~]# kubectl describe svc kubernetes-dashboard --namespace=kube-system
Name:           kubernetes-dashboard
Namespace:      kube-system
Labels:         app=kubernetes-dashboard
Selector:       app=kubernetes-dashboard
Type:           NodePort
IP:         10.254.81.213
Port:           <unset> 80/TCP
NodePort:       <unset> 31785/TCP
Endpoints:      <none>
Session Affinity:   None
No events.

[root@kubeMaster ~]# kubectl get deployment kubernetes-dashboard --namespace=kube-system
NAME                   DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
kubernetes-dashboard   1         0         0            0           6h

[root@kubeMaster ~]# kubectl --namespace=kube-system get ep kubernetes-dashboard
NAME                   ENDPOINTS   AGE
kubernetes-dashboard   <none>      6h

[root@kubeMaster ~]# kubectl cluster-info
Kubernetes master is running at http://kubeMaster:8080

[root@kubeMaster ~]# kubectl get ns
NAME          STATUS    AGE
default       Active    6h
kube-system   Active    6h

[root@kubeMaster ~]# kubectl get ep
NAME         ENDPOINTS            AGE
kubernetes   192.168.11.20:6443   6h
Hugo
  • 155
  • 1
  • 2
  • 9
  • From the command it can say you need to use the IP address 10.254.81.213 and your URL should look like http://10.254.81.213:8001/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard. Also follow this guide for correct dashboard setup - https://jhooq.com/setting-up-kubernetes-dashboard/ – Rahul Wagh Jul 15 '20 at 10:01

6 Answers6

9

192.168.0.0/16 is a private IP range, meaning you need to be within the cluster's network to access it.

The easiest way to access your service outside the cluster is to run kubectl proxy, which will proxy requests to your localhost port 8001 to the Kubernetes API server. From there, the apiserver can proxy to your service:

http://localhost:8001/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

Tim Allclair
  • 7,347
  • 2
  • 27
  • 25
  • 2
    I did that but i still get "This site can’t be reached" – Hugo Feb 08 '17 at 12:33
  • Ah, sorry, I didn't read carefully enough. It looks like you don't have any dashboard pods running. My guess is the pods are crashing for some reason. Try `kubectl get pods --namespace=kube-system`, and then `kubectl describe --namespace=kube-system pod $POD`, where `$POD` is the name of the dashboard pod. If that doesn't work, try describe on the deployment to see any events associated with it. – Tim Allclair Feb 08 '17 at 18:53
  • I don't have any pod [root@kubeMaster ~]# kubectl get pods --namespace=kube-system No resources found. – Hugo Feb 09 '17 at 09:17
  • Did you try describing the deployment? `kubectl describe deployment --namespace=kube-system kubernetes-dashboard` – Tim Allclair Feb 09 '17 at 21:14
  • `[root@kubeMaster ~]# kubectl describe deployment --namespace=kube-system kubernetes-dashboard Name: kubernetes-dashboard Namespace: kube-system CreationTimestamp: Tue, 07 Feb 2017 12:13:21 +0000 Labels: app=kubernetes-dashboard Selector: app=kubernetes-dashboard Replicas: 0 updated | 1 total | 0 available | 1 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge OldReplicaSets: NewReplicaSet: kubernetes-dashboard-3203831700 (0/1 replicas created) No events.` – Hugo Feb 10 '17 at 09:29
6

I know that this is old question, but we spent several hours when looked for solution. It was so silly... Posting it here for next comers...

When you are starting proxy, and browsing to 127.0.0.1:8080/ui/, you are redirected to the following url:

http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy

This url in our case is opened as white empty screen. The issue is that this url is missing slash at the end. When added, everething is working as a charm... :(

http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/

evgenyl
  • 7,837
  • 2
  • 27
  • 32
3

Use:

kubectl proxy

Which will let you access the dashboard at:

localhost:8001
DominikHelps
  • 971
  • 4
  • 10
1

1 used ssh connect master node and config ssh tunnel as below:

ssh tunnel config

2 start kubectl proxy kubectl proxy

3 At localhost, used http url access dashboard http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/about?namespace=default

Jason Yang
  • 11
  • 1
0

To actually find pod with dashboard you should run

kubectl get pods --all-namespaces --show-all

or

kubectl get pods --namespace=kube-system

From what we can see on your outputs you can either run kubectl proxy (already described) or just go to http://{any_node}:31785.

You have dashboard service with Type: NodePort, which means that it will be accessible on NodePort on any node in this cluster.

0

Its not actually running. If it was, your "get deployment" results would return 1's instead of 0's.

try doing a kubectl describe deployment kubernetes-dashboard --namespace=kube-system That will be the first step for your troubleshooting. at the end of the results, it may have something in the events.

you may need to see what the logs are for the pod as well depending on the results of your deployment query.

JamStar
  • 361
  • 1
  • 10
  • [root@kubeMaster ~]# kubectl describe deployment --namespace=kube-system kubernetes-dashboard Name: kubernetes-dashboard Namespace: kube-system CreationTimestamp: Tue, 07 Feb 2017 12:13:21 +0000 Labels: app=kubernetes-dashboard Selector: app=kubernetes-dashboard Replicas: 0 updated | 1 total | 0 available | 1 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge OldReplicaSets: NewReplicaSet: kubernetes-dashboard-3203831700 (0/1 replicas created) No events. – Hugo Feb 10 '17 at 09:36
  • when you do a get pods, use the --all-namepace since its in the kube-system namespace. so its kubectl get pods --all-namespace – JamStar Feb 10 '17 at 14:23
  • i don't have any pod running – Hugo Feb 10 '17 at 14:42
  • [root@kubeMaster ~]# kubectl get pods --all-namespaces No resources found. – Hugo Feb 10 '17 at 14:42
  • have you run through https://kubernetes.io/docs/user-guide/walkthrough/ ? try making just a pod and see what happens. Also, try checking docker to see if the containers were even created. – JamStar Feb 10 '17 at 15:10
  • yes, i create a pod successful [root@kubeMaster ~]# kubectl get pods NAME READY STATUS RESTARTS AGE nginx 1/1 Running 0 4h – Hugo Feb 14 '17 at 18:42
  • but i still don't have a dashboard pod – Hugo Feb 14 '17 at 18:44
  • i deleted and created again, now i have this – Hugo Feb 14 '17 at 19:03
  • [root@kubeMaster ~]# kubectl get po -o wide --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE default nginx 1/1 Running 0 4h 172.30.97.2 kubenode2 kube-system kubernetes-dashboard-3203831700-9f9s7 0/1 CrashLoopBackOff 5 5m 172.30.97.3 kubenode2 – Hugo Feb 14 '17 at 19:04
  • [root@kubeMaster ~]# kubectl logs kubernetes-dashboard-3203831700-9f9s7 --namespace=kube-system Using HTTP port: 9090 E0214 18:55:46.134422 1 config.go:275] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory – Hugo Feb 14 '17 at 19:04
  • if your using certs (whichi t appears to be) its not at that location. put your ca cert there. – JamStar Feb 15 '17 at 16:10
  • i'm not using any certificate this is a standard instalacion I only did what I was in this guide (https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/) Nothing else – Hugo Feb 16 '17 at 10:47