Install Kubernetes Dashboard

Dashboard is a web-based Kubernetes user interface.

Pre-requisites

We are using our Kubernetes homelab to deploy the dashboard.

Install Kubernetes Dashboard

To deploy the dashboard, run the following command:

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml

Accessing the Dashboard UI

Dashboard deploys with a minimal RBAC configuration by default. The dashboard user created here will have administrative privileges and is for homelab purposes only.

Create a dashboard service account:

$ kubectl -n default create serviceaccount dashboard

Create a dashboard-admin cluster role binding dashboard-admin:

$ kubectl -n default create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=default:dashboard

Cluster a cluster-system-anonymous cluster role binding:

$ kubectl create clusterrolebinding cluster-system-anonymous --clusterrole=cluster-admin --user=system:anonymous

Get a dashboard token:

$ kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}"|base64 -d;echo

We can access the dashboard using the following command:

$ kubectl proxy

Kubectl will make dashboard available at:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

The problem with this approach is that the UI can only be accessed from the machine where the command is executed. While it’s not necessary, I’ve created a load balancer in order to access the dashboard on a FQDN using kube-apiserver port:

https://dashboard.apps.hl.test:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Leave a Reply

Your email address will not be published. Required fields are marked *