Access the Kubernetes Dashboard

Deploy and Access the Kubernetes Dashboard

Dashboard is a web-based Kubernetes user interface. Provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.

Deploying the Dashboard UI

The Dashboard UI is not deployed by default. To deploy it, run the following command:

sudo kubectl apply -f

After completing the installation, your pod must be running successfully.

Now, to be able to expose the dashboard for external access, we need to change the service's ClusterIP type to NodePort.

We can make this change simply by editing the service.

sudo kubectl edit service kubernetes

After making the change to NodePort, save and close the file.

When performing a new query, notice that the type has changed and now a new port has been added.

Once this is done, you should have access to the dashboard through the public IP of your instance plus the port that was released.

As we send an http request and expect https then we receive an alert. We can simply move forward by adding https://

Accessing the Dashboard UI

Creating sample user: Grant this user admin permissions and login to Dashboard using a bearer token tied to this user.

Creating a Service Account

apiVersion: v1
kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

Creating a ClusterRoleBinding

We can use it and create only a ClusterRoleBinding for our ServiceAccount

kind: ClusterRoleBinding
  name: admin-user
  kind: ClusterRole
  name: cluster-admin
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

Getting a Bearer Token for ServiceAccount

Execute the following command:

sudo kubectl -n kubernetes-dashboard create token admin-user

Accessing Dashboard

Now we can navigate the dashboard and monitor all clusters.

Last updated