Kubernetes Dashboard WebUI

Kubernetes Dashboard WebUI

We are going to consider the Kubernetes WebUI Dashboard. Dashboard is a web-based Kubernetes user interface. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster resources.

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!

Setup

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:

Shell

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc2/aio/deploy/recommended.yaml

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:

wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc2/aio/deploy/recommended.yaml

And then you can look at the content of Kubernetes Configuration through the sample of recommended.yaml file:

less recommended.yaml

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

kubectl get pods --all-namespaces

We will see 2 pods are out there running - the Dashboard itself and the Scrapper. Another way to look at these would be:

Shell

kubectl --namespace=kubernetes-dashboard get pods

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 admin.yaml file:

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

This file will create a Service Account called admin in the namespace kubernetes-dashboard.

Apply this file:

kubectl apply -f admin.yaml

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 admin_cluster.yaml file:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin
  namespace: kubernetes-dashboard

It takes the Service Account we have just created and it creates a cluster role called admin_cluster.

Next, we need to apply that:

kubectl apply -f admin_cluster.yaml

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:

kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin | awk '{print $1}')

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:

kubectl proxy &

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:

ssh -g -L 8001:localhost:8001 -f -N <[email protected]_dashboard_hostname>

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 Sign in.

cloud kubernetes devops

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

50+ Useful Kubernetes Tools for 2020 - Part 2

Our original Kubernetes tool list was so popular that we've curated another great list of tools to help you improve your functionality with the platform.

Multi-cloud Spending: 8 Tips To Lower Cost

Mismanagement of multi-cloud expense costs an arm and leg to business and its management has become a major pain point. Here we break down some crucial tips to take some of the management challenges off your plate and help you optimize your cloud spend.

Kubernetes in the Cloud: Strategies for Effective Multi Cloud Implementations

This article explains how you can leverage Kubernetes to reduce multi cloud complexities and improve stability, scalability, and velocity.

How to Extend your DevOps Strategy For Success in the Cloud?

DevOps and Cloud computing are joined at the hip, now that fact is well appreciated by the organizations that engaged in SaaS cloud and developed applications in the Cloud. During the COVID crisis period, most of the organizations have started using cloud computing services and implementing a cloud-first strategy to establish their remote operations. Similarly, the extended DevOps strategy will make the development process more agile with automated test cases.

What are the benefits of cloud migration? Reasons you should migrate

To move or not to move? Benefits are multifold when you are migrating to the cloud. Get the correct information to make your decision, with our cloud engineering expertise.