How to log in to the microk8s Kubernetes Dashboard?
kubectl describe service/kubernetes-dashboard -n kube-system
Will return an endpoint. For me it looks like this: 10.1.43.61:8443 Then you can open your browser at https://10.1.43.61:8443 and you probably have to bypass a security warning.
Now you need to authenticate to access the dashboard.
token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token
(this command from the docs) Will return the auth token. Paste the token into the login screen and now you should be able to access the dashboard.
To extend @John's answer, sometimes you could be asked with an HTTP Basic Auth Prompt, you can find those credentials also in:
#/var/snap/microk8s/current/credentials/basic_auth.csv
~/:$ sudo cat /var/snap/microk8s/current/credentials/basic_auth.csv
<password>,admin,admin,"system:masters"
The first value (password
) is the actual password, the user would be admin
.
Later, you could be asked to login by using the secret token. It can be retrieved in this way:
First, let's figure which is the token name (it is randomize) by getting the secret list:
~/:$ kubectl -n kube-system get secret
NAME TYPE DATA AGE
coredns-token-k64mx kubernetes.io/service-account-token 3 86s
.
.
kubernetes-dashboard-token-wmxh6 kubernetes.io/service-account-token 3 80s
The last token (kubernetes-dashboard-token-wmxh6
) is the one we are looking for, let's get the actual value now:
~/:$ kubectl -n kube-system describe secret kubernetes-dashboard-token-wmxh6
Name: kubernetes-dashboard-token-wmxh6
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: kubernetes-dashboard
kubernetes.io/service-account.uid: 538fbe6d-ac1e-40e8-91e9-ec0cf4265545
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1115 bytes
namespace: 11 bytes
token: <token-value>
The value of the token field (<token-value>
) will be the token to login to the K8s dashboard.
From there, you should be fine.