Debian 12 bookworm
Sponsored Link

MicroK8s : Enable Dashboard2023/06/22

 
To enable Dashboard on MicroK8s Cluster, Configure like follows.
[1] Enable Dashboard add-on on primary Node.
root@dlp:~#
microk8s enable dashboard

Infer repository core for addon dashboard
Enabling Kubernetes Dashboard
Infer repository core for addon metrics-server
Addon core/metrics-server is already enabled
Applying manifest
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
secret/microk8s-dashboard-token unchanged

If RBAC is not enabled access the dashboard using the token retrieved with:

microk8s kubectl describe secret -n kube-system microk8s-dashboard-token

Use this token in the https login UI of the kubernetes-dashboard service.

In an RBAC enabled setup (microk8s enable RBAC) you need to create a user with restricted
permissions as shown in:
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md

root@dlp:~#
microk8s enable dns

Infer repository core for addon dns
Enabling DNS
Using host configuration from /etc/resolv.conf
Applying manifest
serviceaccount/coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
clusterrole.rbac.authorization.k8s.io/coredns created
clusterrolebinding.rbac.authorization.k8s.io/coredns created
Adding argument --cluster-domain to nodes.
Adding argument --cluster-dns to nodes.
Restarting kubelet
Restarting nodes.
DNS is enabled

root@dlp:~#
microk8s kubectl get services -n kube-system

NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
metrics-server              ClusterIP   10.152.183.235   <none>        443/TCP                  3m47s
kubernetes-dashboard        ClusterIP   10.152.183.35    <none>        443/TCP                  2m1s
dashboard-metrics-scraper   ClusterIP   10.152.183.115   <none>        8000/TCP                 2m1s
kube-dns                    ClusterIP   10.152.183.10    <none>        53/UDP,53/TCP,9153/TCP   106s

# confirm security token

root@dlp:~#
microk8s config | grep token

    token: Q1BOYnhLMFJUQUZZdkJaaWZCYWJGdGM5eGY1WUNJdmZKZ1A1UHdlLzdCTT0K

# set port-forwarding to enable external access if you need

root@dlp:~#
microk8s kubectl port-forward -n kube-system service/kubernetes-dashboard --address 0.0.0.0 10443:443

Forwarding from 0.0.0.0:10443 -> 8443
[2] Access to [https://(MicroK8s primary node's Hostname or IP address):10443/] with an web browser on any Client computer in local network. Copy and paste the security token you confirmed on [1] to [Enter token] section and Click [Sing In] button.
[3] After authentication successfully passed, MicroK8s Cluster Dashboard is displayed.
Matched Content