How to Enable and Use the Minikube Dashboard

A lightweight virtual machine implementation, Minkube is one of the few ways to easily deploy a local Kubernetes environment for development purposes. With such an environment, you can not only learn the ins and outs of Kubernetes, but you can also begin your development journey. And given how complicated Kubernetes is to deploy itself, having an easy path to getting an environment up and running is a no-brainer for developers and admins new to the world of Kubernetes.
Minikube can be installed very quickly and, along with Docker, you can have that environment up and running in less than five minutes. Once it’s ready, you have full access to the command line, where you can get to work.
However, if you’re either really new to Kubernetes or just prefer a GUI environment to work in, you might be interested in using the Kubernetes Dashboard, which is a web-based Kubernetes user interface that makes it considerably easier to deploy containerized applications to a cluster.
What can you do with the Kubernetes Dashboard? Here’s a short list of features you can manage:
- Cron Jobs
- Daemon Sets
- Deployments
- Jobs
- Pods
- Replica Sets
- Replication Controllers
- Stateful Sets
- Ingresses
- Ingress Classes
- Services
- Storage
- Config Maps
- Secrets
- Persistent Storage
- Namespaces
The list goes on. Effectively, the Kubernetes Dashboard makes it exponentially easier to not only get up to speed with Kubernetes but also to make it easier to manage your deployments. Even deploying applications can be done via a user-friendly form. This helps make the Kubernetes dashboard a must-have for those who are either new to the technology or simply wish to work more efficiently than the command line offers.
I will add this: To anyone who likes the idea of skipping past the complications of Kubernetes (of which there are many), it’s always best to have some understanding of how the command line works; otherwise, you might find yourself doing a lot of guesswork within the GUI.
Also, before we get started with this, there’s one thing you need to know. As with everything involved in Kubernetes, there are always complications. One of the complications with the Kubernetes Dashboard is that, although it’s very simple to access from the machine hosting the cluster, you have to go through an extra step to access it anywhere beyond that. I’ll show you how this is done as well.
But first, we must deploy the Dashboard.
Requirements
To work with the Kubernetes Dashboard, you’ll need a running instance of Minikube. I’ve detailed the process of deploying Minkube here. Make sure to follow that tutorial to get your Kubernetes environment up and running. Once you’ve taken care of that, come back here and continue with how to enable the Dashboard.
Deploying the Kubernetes Dashboard
Now that you have Minkube deployed, it’s time to unleash the Dashboard. Log in to the machine hosting your Minkube Kubernetes cluster and open a terminal window. Make sure everything’s running with the command:
1 |
minikube status |
You should see something like this in the output:
1 2 3 4 5 6 |
minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured |
Now that you are certain everything is up and running deploy the Kubernetes Dashboard with the command:
1 |
minikube dashboard |
You might also want to enable the Ingress controller with:
1 |
minikube addons enable ingress |
It will take a minute or so to deploy. When it does, it will automatically open your default web browser to the default Dashboard page. If it comes up empty, you can always do a quick NGINX deployment with:
1 |
kubectl create deployment my-nginx --image=nginx |
When the Dashboard appears (Figure 1), you should see your NGINX deployment and any other service/app you’ve created.
-
Figure 1: The default Kubernetes Dashboard deployed with Minikube.
How to Access the Dashboard from Outside the Cluster
At the moment, the only way to access the Dashboard is from within the hosting machine. If you want to be able to access from your LAN, you’ll need to do two things. The first is to find out the IP address of the machine hosting the Kubernetes cluster. To do that, open a terminal window and issue the command:
1 |
ip a |
With the IP address of the machine in hand, you next must use the kubectl proxy command, which is:
1 |
kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' |
Here’s the other trick. The URL that opened in your default web browser on the Kubernetes hosting machine will include the address you need to visit in the form of:
1 |
http://127.0.0.1:35025/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/workloads?namespace=default |
To reach the Dashboard beyond the cluster, you’ll want to trade out the localhost ip (127.0.0.1) with the IP address of your hosting server as well as switch the port in the original address with port 8001. So, if the IP address of your hosting machine is 10.0.2.15, the address would be:
1 |
http://10.0.2.15:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/workloads?namespace=default |
The other caveat is that to reach that address, the proxy command must be running. I’ve tried a number of ways (systemd and shell scripts) to successfully get this running, but I’ve yet to have any luck. Because of that, you must run the kubectl proxy command to access the Dashboard from beyond the cluster. Until I can figure out a way to run the kubectl proxy command as a service, you’ll have to use the command. I’m sure there’s a clever way out there to do so. If you know of a method, leave it in the comments.
Until then, happy Dashboarding!