Posted By : Karan
Introduction
Kubernetes is a powerful platform for managing containerized applications, but it can be challenging to manage without the right tools and skilled devops engineers. Kubernetes Dashboard is a web-based graphical user interface (GUI) that allows you to manage and monitor Kubernetes clusters.
It is an open-source project which is managed by the Kubernetes community. We can also create, update and delete Kubernetes resources. The best thing is that we can monitor the metrics and logs of the pods directly in the dashboard with a very user-friendly interface, which can also be helpful for troubleshooting and performance monitoring.
Installing Kubernetes Dashboard
Ensure your Kubernetes Cluster is Up and running, also you must have kubectl (Kubernetes command line utility) installed and connected to your cluster.
Execute the following command, it will deploy all the necessary resources in order to start the dashboard.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
Now you can check the resources in kubernetes-dashboard namespace by using following command:
kubectl get all -n kubernetes-dashboard
You can access the dashboard by port forwarding the pod or by editing its service type. Right now it is of CluterIP. You can set it to NodePort or LoadBalance.
We will use port forwarding , but before that, we will create a service account and cluster role binding to give it a cluster admin role.
You can use the following commands for that:-
kubectl create serviceaccount dashboard -n kubernetes-dashboard
kubectl create clusterrolebinding dashboard-admin -n kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=default:dashboard
Now the last step would be to port forward the dashboard pod by using the following command:
kubectl -n kubernetes-dashboard port-forward kubernetes-dashboard-7979bc45d5-zpm85 8090:8443 --address 0.0.0.0
Now you can access the dashboard in your localhost 8090 port.
For the token, you can get the secret using the following command.
kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode
Now you can easily manage and monitor your kubernetes resources by using the dashboard.
Some of the key use cases of Kubernetes Dashboard include:
Conclusion
Kubernetes Dashboard is a powerful tool for managing and monitoring Kubernetes clusters. With its intuitive interface and built-in RBAC capabilities, it makes managing Kubernetes resources easy and secure. By following the steps outlined in this blog post, you can quickly set up Kubernetes Dashboard and start exploring its many use cases.
December 13, 2024 at 09:22 pm
Your comment is awaiting moderation.