Kubernetes Dashboard WebUI
The Web User Interface allows us to browse our playground cluster and perform administrative tasks and things like that.
Join the DZone community and get the full member experience.Join For Free
In this topic, we are going to consider the Kubernetes WebUI Dashboard. The Web User Interface allows us to browse our playground cluster and perform administrative tasks and things like that. It gives a good way to see what you have done on your playground without having to use the command line. So, let's get started!
The first thing we do is to use
kubectl apply command to apply the configuration to a resource by a specified filename. The resource name must be specified and if the resource does not exist it will be created.
In our case the file is provided by Kubernetes repo:
Once we apply the recommended file, it will create the namespace for Kubernetes Dashboard that includes the Metrics Scraper and Dashboard.
If you want to take a closer look at what that
yaml file does, you need to get it to your local system:
And then you can look at the content of Kubernetes Configuration through the sample of
We can see all of the separate Kubernetes objects that have been created by
kubectl apply the command. The secrets, configuration map, role creation, the cluster role together with binding. By looking at this sample and the deployment itself you can learn a lot about the
yaml format and you can see what it is actually doing to our playground cluster in order to install the Dashboard.
Moving forward to the next command
We will see 2 pods are out there running - the Dashboard itself and the Scrapper. Another way to look at these would be:
Here we need to specify the namespace.
Next, we need to create the
yaml file in order to create an admin user in the Kubernetes Dashboard. Please paste the following to the
This file will create a Service Account called
admin in the namespace
Apply this file:
Once we execute the file, it creates the Service Account
admin. Next, we need to create the admin cluster role binding. Please paste the following to the
It takes the Service Account we have just created and it creates a cluster role called
Next, we need to apply that:
The next command we are going to use is in the namespace
kubernetes-dashboard where we will explore a secret. We have to do a trick here to get that secret:
When we do that, we will see that we have an encrypted token. The point is to get the token for the
admin user which we have created, copy it, and save it to use if for logging into the Kubernetes WebUI Dashboard. Please copy the token in any text file you want and save it for future use.
Moving forward, we are going to start the proxy in order to expose the Dashboard on your localhost and run it on a background:
Now, if you have started your dashboard, not on a local machine you need to turn on the tunnel to your Kubernetes Dashboard to make it reachable from your
localhost. Please open a new terminal window and run the following command:
Once you run the command you can then use the following localhost:8001 Link
In order to token to the Dashboard, please copy the token from your text file and paste it, and click
If you are new to it, please spend some time looking around it to understand the menu and how it works. Here is an example of Kubernetes Dashboard:
Possible Problems and Solutions
It might occur that your dashboard pods are in a Pending state. Usually, the reason is that Kubernetes Network is not configured. You may notice that
kube-dns are stuck in Pending state. Don't worry, this is an expected part of the design. Kubernetes is network-provider agnostic, so you should install the pod network solution of your choice, for instance, Flannel or Calico. You have to install a pod network solution before
kube-dns may be fully deployed.
In this article, we will use Calico as a pod network solution. So, please run the following command in order to initialize the master:
Optional. If you haven't configured your
kubectl yet, please execute the following commands:
The last step would be to install Calico:
Now, confirm that all of the pods are up and running with the following command:
That's it! Now you are ready to run
kubectl proxy command and access your Dashboard running on a single-host Kubernetes cluster equipped with Calico.
For the record, it might be an option when you need to remove the taints on the master so that you can schedule your pods on it. In this case, please run the following command:
You will see the result that node was untained. Following that, confirm that you now have a node in your cluster with the following command:
As a result, we now have a running Kubernetes Dashboard, which is equipped with a Calico virtual networking solution and we may conclude that the Kubernetes Dashboard is a really great way to understand and visualize what is going on in your cluster.
Published at DZone with permission of Sudip Sengupta. See the original article here.
Opinions expressed by DZone contributors are their own.