DEV Community

Cover image for Kubernetes: Deploy dashboard
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Kubernetes: Deploy dashboard

Kubernetes provides a dashboard to manage your cluster, to install it first we need to make sure we have Helm installed in our system.

helm version
Enter fullscreen mode Exit fullscreen mode

If we have Helm installed it will output something similar to this:

version.BuildInfo{Version:"v3.17.3", GitCommit:"...", GitTreeState:"clean", GoVersion:"go1.23.7"}
Enter fullscreen mode Exit fullscreen mode

If you don't have it installed, run the following command:

sudo snap install helm --classic
Enter fullscreen mode Exit fullscreen mode

Deploy the dashboard

Once we have Helm installed, we have to add the kubernetes-dashboard repository:

helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
Enter fullscreen mode Exit fullscreen mode

Next, we deploy the dashboard:

helm upgrade --install kubernetes-dashboard \
    kubernetes-dashboard/kubernetes-dashboard \
    --create-namespace --namespace kubernetes-dashboard
Enter fullscreen mode Exit fullscreen mode

Access the dashboard

To access the dashboard we need to obtain a bearer token:

kubectl -n kubernetes-dashboard create token default
Enter fullscreen mode Exit fullscreen mode

Once we have the bearer token, we need to start the port forwarding:

kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443
Enter fullscreen mode Exit fullscreen mode

This command will forward the 443 pod's port to the 8443 localhost's port. If we cannot access the localhost, we can specify the address to bind, like 0.0.0.0.

kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 --address 0.0.0.0
Enter fullscreen mode Exit fullscreen mode

You will can use the dashboard as long as the port forwarding is working. If you want to always be able to access the dashboard read the official documentation about authentication and authorization.

Top comments (0)