dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

Accessing the Kubernetes Dashboard in Rancher 2.0

Open fbotha-stratuscloud opened this issue 8 years ago • 12 comments

Environment

Heapster version: 0.2.9 Dashboard version: 0.6.3 Rancher version: 2.0.0 Kubernetes version: v1.10.1-rancher1 Operating system: Ubuntu 16.04 LTS

Steps to reproduce

Deploy heapster using kubernetes helm chart in Rancher 2.0 Catalog Apps Deploy kubernetes-dashboard using kubernetes helm chart in Rancher 2.0 Catalog Apps Run kubectl proxy Access http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Observed result

Rancher 2.0 returns 404 - The page you were looking for doesn't exist!

Expected result

Expected to see the Kubernetes Dashboard

Comments

Haven't been able to get the Kubernetes Dashboard working on Rancher 2.0. Any assistance would be appreciated.

fbotha-stratuscloud avatar May 18 '18 11:05 fbotha-stratuscloud

Also tried accessing http://localhost:8001/k8s/clusters/c-cdlfs/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy

Which results in a {"type":"error","status":"401","message":"must authenticate"}

fbotha-stratuscloud avatar May 18 '18 12:05 fbotha-stratuscloud

+1

weslleycamilo avatar May 28 '18 18:05 weslleycamilo

I managed to gain access to the Kubernetes Dashboard. You first need to login to Rancher 2.0 as usual, then access it at the following URL through Rancher:

https://rancher.example.com/k8s/clusters/local/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

bootc avatar May 28 '18 19:05 bootc

I have the same issue why Rancher is not documenting all this

http://localhost:8001/k8s/clusters/local/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ {"Code":{"Code":"ServerError","Status":500},"Message":"NotFound 404: clusters.management.cattle.io "local" not found","Cause":null,"FieldName":""}

same issue

Try https://mydomain site and localhost:8001/k8s/clusters/local/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ in both cases give the same error {"Code":{"Code":"ServerError","Status":500},"Message":"NotFound 404: clusters.management.cattle.io "local" not found","Cause":null,"FieldName":""}

mgamboa avatar Jun 17 '18 13:06 mgamboa

bootc has the correct answer.

You must combine the rancher server URL and the /k8s/clusters/<cluster id> prefix to the api path for the dashboard service (/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/).

If you browse to your cluster page in the Rancher UI you will see the cluster id in the URL which looks like c-dc2mk.

You first need to have a valid rancher UI session token, so keep a page to your rancher cluster open in the browser.

Then:

https://rancher.example.com/k8s/clusters/<cluster id>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

alexandrem avatar Jun 20 '18 01:06 alexandrem

Hi, I tried: https://blablabla.pl/k8s/clusters/c-c2ntk/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

and when I'm providing kube config (which works locally as I can do kubectl get nodes) I'm getting "Authentication failed. Please try again."

kamilgregorczyk avatar Jun 26 '18 13:06 kamilgregorczyk

You can't use kubeconfig sign-in with Rancher.

You must skip this in the dashboard login and must define a serviceaccount with clusterrole in the dashboard deployment.

alexandrem avatar Jun 26 '18 13:06 alexandrem

I used Rancher 2.0 Catalog Apps helm to deploy kubernetes-dashboard But it can't deploy in kube-system namespace, just used default namespace or create new namespace. kubernetes-dashboard pod CrashLoopBackOff , I got log from pod: secrets is forbidden: User "system:serviceaccount:kubernetes-dashboard:kubernetes-dashboard" cannot create secrets in the namespace "kube-system"

dommgifer avatar Jul 10 '18 04:07 dommgifer

I deployed it with kubectl and then I also had to create some account in kubernetes and it worked. But that's weird that you can't deploy something in the kube-system ns

wt., 10 lip 2018, 06:02 użytkownik dommgifer [email protected] napisał:

I used Rancher 2.0 Catalog Apps helm to deploy kubernetes-dashboard But it can't deploy in kube-system namespace, just used default namespace or create new namespace. kubernetes-dashboard pod CrashLoopBackOff , I got log from pod: secrets is forbidden: User "system:serviceaccount:kubernetes-dashboard:kubernetes-dashboard" cannot create secrets in the namespace "kube-system"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/dashboard/issues/3039#issuecomment-403693018, or mute the thread https://github.com/notifications/unsubscribe-auth/AI1koGG4dwInjm26ARG6_cV2NsCr0y9Iks5uFCcfgaJpZM4UEmi4 .

kamilgregorczyk avatar Jul 10 '18 05:07 kamilgregorczyk

@alexandrem I skipped the dashboard login, how do you define a serviceaccount with clusterrole now? Do I do that in the k8s UI or rancher UI? screen shot 2018-07-12 at 11 09 30 am

apoorva11029 avatar Jul 12 '18 18:07 apoorva11029

@apoorva11029 You can find an example of clusterrole documented here:

https://github.com/kubernetes/dashboard/wiki/Access-control#admin-privileges

You must create this in Kubernetes (e.g with kubectl).

alexandrem avatar Jul 12 '18 19:07 alexandrem

/close

jimangel avatar Aug 29 '18 05:08 jimangel