11

There's information how to enable the dashboard extension

microk8s.enable dashboard

(which I ran) and how to display URLs of other extensions enabled like this:

kubectl cluster-info

How to get the URL of the dashboard of a microk8s installation running locally on Ubuntu 18.10?

Kalle Richter
  • 5,935
  • 20
  • 69
  • 101
  • Follow-up question: https://stackoverflow.com/questions/46664104/how-to-sign-in-kubernetes-dashboard – Kalle Richter Jun 10 '19 at 22:36
  • this is how I accessed the dashboard from outside the cluster network. I hope you find it helpful! https://:/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#/login – Xevious202 Apr 22 '20 at 16:52

3 Answers3

14

I just use

microk8s dashboard-proxy

which results in

Checking if Dashboard is running.
Dashboard will be available at https://127.0.0.1:10443
Use the following token to login:
eyJhbGciOiJSUzI1NiIsImtpZCI6ImJVTm01V1dBSHJUQVNtenFrRHExRWFPakd4X090QzVYQkcxUmRvdkItaUUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkZWZhdWx0LXRva2VuLXprdmQ5Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImRlZmF1bHQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJhMDVlZmFkNS03MzE1LTRiYzctOTk4OC04ZDg5YzA0YmU0YjIiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGVmYXVsdCJ9.Oqqkn5hQoaWqwE6puYgrcWKKVzEwO49JZYWntXEnx2hycIlyhfbWWLPoJmboRMh4Ox85eZsuPmd9BuHLC9MfbR62XlXaEQlE3Pc-G9J7nR-eekXJaN6xVQWrL-uKNG5mnoPAFpD0LskdHTrlX1BL3zLRoX2LGRlk2xozNjlOwDpnJmhHR8u7naWxb-YZBeRov757GJNu7n2N5iysba5tyf3X_NkNyTl9sjmiUGIo9o2xIujWPxmlpbqvUP5wcEEf9z6oIUjWP78WCZPl9RvpHU3o1lKe2WwC_PKZQga5qATuLJfv1L0hhOFOeuui70c2L0bUuozfMlEw77AIpALwGg

It works in Firefox without issues. For Google Chrome I had to enable the flag allow-insecure-localhost to allow local websites without correct security. This is done by opening chrome://flags/#allow-insecure-localhost and enabling the flag as shown:

chrome : Allow invalid certificates for resources loaded from localhost

Kalle Richter
  • 5,935
  • 20
  • 69
  • 101
Koen
  • 1,107
  • 6
  • 15
  • Yes this process worked in Centos 7 with Firefox browser to display the Dashboard. Run $ microk8s kubectl get all --all-namespaces and this will give you the ClusterIP:port for the service/kubernetes-dashboard ClusterIP 10.152.183.55 443/TCP . Then run $ curl -k -v https:// 10.152.183.55:443 on the server and you will see the Dashboard login webpage. – ebeb Feb 23 '23 at 15:22
6

You can get the IP with

kubectl -n kube-system get service/kubernetes-dashboard -o go-template={{.spec.clusterIP}}

which shows the IP address which you need to access with https:// prefixed in your browser because there's no redirect from HTTP to HTTPS.

Kalle Richter
  • 5,935
  • 20
  • 69
  • 101
  • A comment from [here](https://github.com/ubuntu/microk8s/issues/234), explains why the dashboard isn't visible when using `kubectl cluster-info`: "to have the dashboard (or any other service) appear in the cluster-info list you need to add the `kubernetes.io/cluster-service=true` label to its service. Upstream dashboard is not applying this label nor do we" – dutoitns Jun 17 '19 at 12:52
2

You can run

kubectl describe service/kubernetes-dashboard -n kube-system

and then you can go to the Endpoints specified https://<ip>:<port>. So in my case https://10.1.43.61:8443

Name:              kubernetes-dashboard
Namespace:         kube-system
Labels:            k8s-app=kubernetes-dashboard
Annotations:       Selector:  k8s-app=kubernetes-dashboard
Type:              ClusterIP
IP:                10.152.183.28
Port:              <unset>  443/TCP
TargetPort:        8443/TCP
Endpoints:         10.1.43.61:8443
Session Affinity:  None
Events:            <none>

But Chromium didn't let me enter the site (not even under "advanced") chromium

Thus I had to use Firefox where you will need to authenticate. firefox auth

You can authenticate with a token. To get the token run (dcoumentation):

token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)

microk8s kubectl -n kube-system describe secret $token

Now you can copy and paste the token and you should be able to access the dashboard.

Florian Ludewig
  • 115
  • 3
  • 16