Overview of How to Install Kubernetes Dashboard
The following article provides an outline for Install Kubernetes Dashboard. Kubernetes is a container management tool. The main goal of this tool is deploying containers, scaling and descaling containers, balancing containers load. It is not based on the containerization platform; it provides solutions for managing multiple containers. It supports multiple cloud and bare-metal environments. It is 100% Open source, written in Gonne. Google pushed Kubernetes to open source two years ago. One of its key selling points is that it has been used to run Google’s massive systems for so long. Kubernetes Dashboard is a Web-Based User Interface for Kubernetes Clusters.
Kubernetes provides a dashboard for users to interact with Kubernetes and perform some tasks. Kubernetes dashboard allows users to troubleshoot their application and add the containerized application on the Kubernetes cluster and manage them efficiently. It also gives an overview of all the applications which are running on the Kubernetes. Kubernetes dashboard shows the state of all the resources running on the cluster, and if some error occurs, it shows that information. In this article, we are going to see the installation process of the Kubernetes dashboard.
Steps to Install Kubernetes Dashboard
To install the Kubernetes dashboard, follow the below steps carefully:
If you have a $HOME/.kube/config file, and if it is not listed in the Kube Config environment variable, then run the following command.
Code:
export KUBECONFIG=/etc/kubernetes/admin.conf
Step 1: How to Deploy the Kubernetes Dashboard?
To deploy the Kubernetes Dashboard, run the following command:
Code:
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
Then the output will be as following:
secret/kubernetes-dashboard-certs created
serviceaccount/kubernetes-dashboard created
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
deployment.apps/kubernetes-dashboard created
service/kubernetes-dashboard created
Step 2: How to verify Dashboard Service is Running?
After the creation of the Dashboard, verify the svc/deployments are up and running.
Step 3: How to describe Install Kubernetes Dashboard?
To view the svc info, Run the following command.
Code:
kubectl describe svc/kubernetes-dashboard -n Kube-system
After that, to verify the Kubernetes dashboard pods is up and running, the run command is given below:
Code:
kubectl get pods --all-namespaces
You can permit full admin privileges to Dashboard’s Service Account. To do this, you have to create below ClusterRoleBinding.
Code:
cat dashboard-admin.yaml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels: k8s-app: kubernetes-dashboard
roleRef: API groups: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects: - kind: ServiceAccount
name: kubernetes-dashboard
namespace: Kube-system
Copy the YAML file based on installation method and save that file as given name: a dashboard-admin.yaml
Use the command which is given below to deploy it.
Code:
kubectl create -f dashboard-admin.yaml
The output will be as follows:
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
After that, you can use the Skip option on the login page to access Dashboard.
Step 4: How to access the Installed Kubernetes Dashboard?
For setting the proxy, run the following command:
Code:
kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
Starting to serve on [::]:8001
To get access to the installed Kubernetes Dashboard, run the following command:
Code:
HTTP://<IP>:<PORT>/api/v1/namespaces/Kube-system/services/https:kubernetes-dashboard:/proxy/#!/login
After that, you can see the dashboard page.
After that, go to the Control Panel present on the dashboard page, and click on sign in, as shown below.
Step 5: How to do you Install Kubernetes Dashboard Authentication using Token?
i. Create a new ServiceAccount
For that, run the following command:
Code:
kubectl create serviceaccount k8sadmin -n Kube-system
The output will be as follows
serviceaccount/k8sadmin created
ii. After that, Create a ClusterRoleBinding with Cluster Admin Privileges by Using the Following Command
Code:
kubectl create cluster role binding k8sadmin --clusterrole=cluster-admin --serviceaccount=kube-system:k8sadmin
then the output will be as follows clusterrolebinding.rbac.authorization.k8s.io/k8sadmin created
To get the token, run the following command:
Code:
kubectl get secret -n Kube-system | grep k8sadmin | cut -d " " -f1 | xargs -n 1 | xargs kubectl get secret -o 'jsonpath={.data.token}' -n Kube-system | base64 --decode
Then we will get base64 decoded Token as output which is as follows:
Code:
eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9
Copy this token and paste it under the token button.
Now you have Logged in to the Kubernetes dashboard.
Step 6: How to Delete Kubernetes dashboard Services?
To delete the Kubernetes dashboard Services, 1st check where the services are present, which we want to delete. i.e. the path of those services.
To check that, run the given command:
Code:
daemon sets,replica sets,services,deployments,pods,RC --all
After that, we can delete services with their paths
kubectl delete replica sets/kubernetes-dashboard -n Kube-system
kubectl delete svc/kubernetes-dashboard -n Kube-system
kubectl delete deployments/kubernetes-dashboard -n Kube-system
kubectl -n Kube-system delete $(kubectl -n Kube-system get pod -o name | grep dashboard)
Step 7: How to Edit Kubernetes Dashboard Services?
To Edit Kubernetes dashboard Services, run the given command:
Code:
kubectl edit svc/kubernetes-dashboard -n kube-system
Recommended Articles
This has been a guide to Install Kubernetes Dashboard. Here we have discussed the basic overview and easiest way to Install Kubernetes Dashboard. You can also go through our other suggested articles to learn more –
360+ Online Courses | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7
View Course
Related Courses