How to deploy the Kubernetes WebUI with MicroK8s

Looking for a web-based tool to manage Microk8s? Look no further than the Kubernetes dashboard.

If you have anything to do with IT, Kubernetes needs no introduction. However, you might not know that there’s a powerful web UI that makes working with Kubernetes significantly easier. With this web-based UI, you can manage nearly every aspect of your Kubernetes cluster (even manage certificate rotation and configure your cloud provider firewalls).

I want to walk you through the process of deploying and accessing this must-have Kubernetes web-based manager via Microk8s.

What you’ll need

The only things you’ll need to make this happen are a running Kubernetes cluster and a user with sudo privileges. I’ll be demonstrating on Ubuntu Desktop 19.04, with the help of a Microk8s deployment.

To find out how to deploy Microk8s, see How to get a single-node Kubernetes deployment up in seconds.

How to deploy the WebUI

If you’ve deployed MicroK8s, you should automatically have the WebUI ready to access. In order to deploy the WebUI, log into your machine hosting the Microk8s deployment and issue the following command:

sudo microk8s.enable dns dashboard

Once the dashboard has been added, you need to find the IP address associated with the service. To do this, issue the command:

sudo microk8s.kubectl get all --all-namespaces

The above command will list out all namespaces, along with their associated IP addresses (Figure A).

Figure A


Our kubernetes namespace listing.

As you can see, our dashboard address is listed at Point your web browser to the IP address associated with your deployment (using HTTPS) and you will be greeted with a window requiring a token (Figure B).

Figure B


The token entry window.

How to create a login token

In order to sign into the dashboard, you must first create a login token. To do that, you’ll first need to list out all the secrets available to Microk8s. Issue the command:

sudo microk8s.kubectl -n kube-system get secret

You will see a list of all service names, including their secret name attached. What you are looking for is the line:


Where XXXX is a random string of four characters. Copy that entire section of the line, including the four random characters, and issue the command:

sudo microk8s.kubectl -n kube-system describe secret kubernetes-dashboard-token-XXXX

Where XXXX is the random string.

The above command will display a very long string of characters. Copy that string and paste it into the token string of the Kubernetes dashboard sign in window. Once you’ve done that, click Sign In you’ll find yourself on the dashboard, ready to manage your MicroK8s deployment (Figure C).

Figure C


The Dashboard, ready to rock.

And that’s all there is to deploying and signing into the Kubernetes WebUI dashboard. If you’re looking for one of the best routes to start developing with Kubernetes, you won’t find a better option than Microk8s and the WebUI.

Source: techrepublic