How to access micro8ks's dashboard web UI?

Solution 1:

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

Solution 2:

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.

Solution 3:

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.