Configure web-based Kubernetes user interface

In this post, you will learn how to configure web-based Kubernetes user interface or deploy Web GUI on Kubernetes cluster and access the Kubernetes Dashboard

The 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 itself along with its attendant resources.
You can use Dashboard to get an overview of applications running on your cluster, as well as for creating or modifying individual Kubernetes resources, such as Deployments, Jobs, Daemon Sets, etc.
Dashboard also provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.
In this Lab, you will learn the below items:

Objectives:
Deploy Dashboard UI
Configure Dashboard
Create Service Account for Dashboard
Deploy Application from Dashboard
Clean-up

Note: Ensure you have the running cluster deployed.

Learn How to Deploy Kubernetes Cluster on Centos 7 from Scratch

1.1 Ensure that you have logged-in as root user on kube-master node.
1.2 Let us clone the git repository which contains manifests to deploy and configure the Dashboard UI, by executing the below command.

# git clone https://github.com/EyesOnCloud/k8s-dashboard.git

Output:

1.3 Let us deploy the Dashboard UI, by executing the below command.

# kubectl apply -f ~/k8s-dashboard/recommended.yaml

Output:


1.4 Dashboard Configuration
Kubernetes supports two ways of authenticating and authorizing users.

Authorization: is handled by Kubernetes API server. Dashboard only acts as a proxy and passes all auth information to it. In case of forbidden access, corresponding warnings will be displayed in Dashboard.

Authentication Based on:

• Bearer Token that can be used on Dashboard.
• Kubeconfig file that can be used on Dashboard.

1.5 Verify the kubernetes-dashboard pod is in running state under kubernetes-dashboard namespaces.

# kubectl get pods -n kubernetes-dashboard

Output:

1.6 Verify the services status.

# kubectl get svc -n kubernetes-dashboard

Output:

7. Edit the kubernetes-dashboard service file.

# kubectl -n kubernetes-dashboard edit service kubernetes-dashboard


Note: change “type: ClusterIP” to “type: NodePort” and Save and exit by press Esc:wq!

8. Verify the services status, once after saving the changes to kubernetes-dashboard

# kubectl get svc -n kubernetes-dashboard

Output:

9. Let us create a Service account named “admin-user”, by executing the below command.

# kubectl apply -f ~/k8s-dashboard/admin-user.yaml

Output:

10. Let us add cluster-admin role to the admin-user, by executing the below command.

# kubectl apply -f ~/k8s-dashboard/dashboard-admin.yaml

Output:


1.11 Execute below commands to capture the dashboard token.

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

Output:

2 Let us access the Kubernetes Dashboard now!

a. Enter the above your URL with SERVICE PORT and click on “Token” to access the dashboard

https://192.168.100.11:Node_PORT

Copy the TOKEN value from the above output and paste in the box below

b. View the Dashboard now!



3 Deploy the MyEmp Application using dashboard service.

Deploy the mongo container by clicking “+” button and then click on “Create from form”.


Deploy the node.js container by clicking “+” button on the right side. Enter the following details:
a. App name: myemp
b. Container image: eyesoncloud/k8s-images:employee
c. Number of Pods: 1
d. Service: External
e. Port: 80
f. Target port: 8888


a. Review the Deployments, pods status


Take a note of the NodePort from the Services section, by scrolling down in the same screen.


4 Access the Employee Application

http://192.168.100.11:node_port


5 Let us clean up by deleting the deployment, by executing the below command.

# kubectl delete deploy myemp

Output:


5.1 Let us delete the service, by executing the below command.

# kubectl delete svc myemp

Output:

Subscribe
Notify of
guest

0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x