๐ Part 3 Efficient Kubernetes Management: Secure Your Cluster with the Dashboard


1๏ธโฃ Overview
The Kubernetes Dashboard is a web-based user interface that empowers you to efficiently manage and monitor your Kubernetes clusters. With this tool, you can:
Monitor cluster resources such as pods, deployments, and services
Manage workloads by scaling applications and restarting pods
Inspect logs and troubleshoot issues
Access real-time cluster metrics
By the end of this guide, you'll have a fully configured Kubernetes Dashboard with secure access and role-based authentication (RBAC).
2๏ธโฃ Deploying the Kubernetes Dashboard
๐น Why is this important?
The Dashboard provides a graphical interface to manage Kubernetes.
It helps track resource usage and diagnose issues quickly.
๐น Step 1: Deploy the Dashboard
Kubernetes provides an official YAML file to deploy the Dashboard:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
โ Sample Output:
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
๐น Step 2: Verify the Deployment
Check if the Dashboard pods are running:
kubectl get pods -n kubernetes-dashboard
โ Expected Output:
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-6b7d8f5c89-xyz12 1/1 Running 0 1m
๐น Step 3: Expose the Dashboard Service
By default, the Dashboard is exposed as a ClusterIP service (internal only). To access it externally, you need to use kubectl proxy:
kubectl proxy
Now, open the Dashboard in a browser:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
๐ Problem: By default, access is restricted. Letโs set up authentication.
3๏ธโฃ Configuring Secure Access (RBAC Authentication)
๐น Why is RBAC Needed?
Kubernetes restricts Dashboard access by default.
Role-Based Access Control (RBAC) grants fine-grained permissions.
๐น Step 1: Create an Admin Service Account
Create a YAML file for the admin user:
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
Apply it:
kubectl apply -f admin-user.yaml
โ Sample Output:
serviceaccount/admin-user created
clusterrolebinding.rbac.authorization.k8s.io/admin-user created
๐น Step 2: Get the Authentication Token
Run the following command to get the bearer token:
kubectl get secret $(kubectl get sa admin-user -n kubernetes-dashboard -o jsonpath="{.secrets[0].name}") -n kubernetes-dashboard -o jsonpath="{.data.token}" | base64 --decode
Copy the token and save it. You will need it to log in.
๐น Step 3: Access the Dashboard
1๏ธโฃ Start the Dashboard Proxy:
kubectl proxy
2๏ธโฃ Open the Dashboard in your browser:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
3๏ธโฃ Select "Token Authentication" and paste the copied token.
โ Dashboard Sample Output:
4๏ธโฃ Managing Workloads via Dashboard
Now that the Dashboard is set up, you can:
โ
View running applications: Pods, Deployments, Services
โ
Scale applications: Increase or decrease replicas
โ
Check logs: Debug issues with pod logs
โ
Delete & restart pods: Manage application lifecycle
5๏ธโฃ Troubleshooting & Common Issues
๐น Issue: "Forbidden" when accessing the Dashboard
Solution: Ensure the correct RBAC roles are assigned:
kubectl describe clusterrolebinding admin-user
๐น Issue: Dashboard pods stuck in "Pending"
Solution: Check cluster resources:
kubectl get events -n kubernetes-dashboard
kubectl describe pod -n kubernetes-dashboard <pod-name>
๐ฏ Conclusion
๐ Kubernetes Dashboard is fully deployed and secured!
โ
Web-based Kubernetes management is now available
โ
RBAC authentication is configured
โ
Cluster monitoring & troubleshooting is easier
๐ Next Step: Advanced Kubernetes Monitoring with Prometheus, Grafana, Node Exporter & cAdvisor
Subscribe to my newsletter
Read articles from Vikas Surve directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Vikas Surve
Vikas Surve
I am an ๐ ๐ฆ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฒ๐ฑ ๐๐ฒ๐๐ข๐ฝ๐ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ ๐๐ ๐ฝ๐ฒ๐ฟ๐ and ๐๐๐๐ฟ๐ฒ ๐๐ฑ๐บ๐ถ๐ป๐ถ๐๐๐ฟ๐ฎ๐๐ผ๐ฟ ๐๐๐๐ผ๐ฐ๐ถ๐ฎ๐๐ฒ with over ๐ญ๐ฌ ๐๐ฒ๐ฎ๐ฟ๐ ๐ผ๐ณ ๐ฒ๐ ๐ฝ๐ฒ๐ฟ๐ถ๐ฒ๐ป๐ฐ๐ฒ in designing, implementing, and optimizing DevOps solutions. My expertise includes ๐๐/๐๐ ๐ฎ๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป ๐๐๐ถ๐ป๐ด ๐๐ถ๐๐๐ฎ๐ฏ, ๐๐ฒ๐ป๐ธ๐ถ๐ป๐, ๐ฎ๐ป๐ฑ ๐๐๐๐ฟ๐ฒ ๐๐ฒ๐๐ข๐ฝ๐, as well as ๐๐ผ๐ป๐๐ฎ๐ถ๐ป๐ฒ๐ฟ ๐ผ๐ฟ๐ฐ๐ต๐ฒ๐๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐๐ถ๐๐ต ๐๐ผ๐ฐ๐ธ๐ฒ๐ฟ ๐ฎ๐ป๐ฑ ๐๐๐ฏ๐ฒ๐ฟ๐ป๐ฒ๐๐ฒ๐. ๐น ๐๐ ๐ฝ๐ฒ๐ฟ๐ ๐ถ๐ป ๐ฑ๐ฒ๐๐ถ๐ด๐ป๐ถ๐ป๐ด ๐ฎ๐ป๐ฑ ๐บ๐ฎ๐ป๐ฎ๐ด๐ถ๐ป๐ด ๐ฒ๐ป๐ฑ-๐๐ผ-๐ฒ๐ป๐ฑ ๐๐/๐๐ ๐ฝ๐ถ๐ฝ๐ฒ๐น๐ถ๐ป๐ฒ๐ ๐น ๐๐ฎ๐ป๐ฑ๐-๐ผ๐ป ๐ฒ๐ ๐ฝ๐ฒ๐ฟ๐ถ๐ฒ๐ป๐ฐ๐ฒ ๐๐ถ๐๐ต ๐๐๐๐ฟ๐ฒ, ๐๐๐ฏ๐ฒ๐ฟ๐ป๐ฒ๐๐ฒ๐ (๐๐๐ฆ), ๐ฎ๐ป๐ฑ ๐ง๐ฒ๐ฟ๐ฟ๐ฎ๐ณ๐ผ๐ฟ๐บ ๐ณ๐ผ๐ฟ ๐๐ฐ๐ฎ๐น๐ฎ๐ฏ๐น๐ฒ ๐ฑ๐ฒ๐ฝ๐น๐ผ๐๐บ๐ฒ๐ป๐๐ ๐น ๐ฃ๐ฎ๐๐๐ถ๐ผ๐ป๐ฎ๐๐ฒ ๐ฎ๐ฏ๐ผ๐๐ ๐ฎ๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป, ๐๐ฒ๐ฐ๐๐ฟ๐ถ๐๐, ๐ฎ๐ป๐ฑ ๐ฐ๐น๐ผ๐๐ฑ-๐ป๐ฎ๐๐ถ๐๐ฒ ๐๐ฒ๐ฐ๐ต๐ป๐ผ๐น๐ผ๐ด๐ถ๐ฒ๐ ๐ ๐ฆ๐ธ๐ถ๐น๐น๐ & ๐ง๐ผ๐ผ๐น๐ โ ๐๐ฒ๐๐ข๐ฝ๐ & ๐๐/๐๐: Azure DevOps, GitLab, Jenkins โ ๐๐น๐ผ๐๐ฑ & ๐๐ป๐ณ๐ฟ๐ฎ๐๐๐ฟ๐๐ฐ๐๐๐ฟ๐ฒ: Azure, AWS โ ๐๐ป๐ณ๐ฟ๐ฎ๐๐๐ฟ๐๐ฐ๐๐๐ฟ๐ฒ ๐ฎ๐ ๐๐ผ๐ฑ๐ฒ (๐๐ฎ๐): Terraform, Bicep โ ๐๐ผ๐ป๐๐ฎ๐ถ๐ป๐ฒ๐ฟ๐ & ๐ข๐ฟ๐ฐ๐ต๐ฒ๐๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป: Docker, Kubernetes (AKS) โ ๐๐ผ๐ป๐ณ๐ถ๐ด ๐ ๐ฎ๐ป๐ฎ๐ด๐ฒ๐บ๐ฒ๐ป๐: PowerShell, Shell Scripting โ ๐ ๐ผ๐ป๐ถ๐๐ผ๐ฟ๐ถ๐ป๐ด & ๐ข๐ฏ๐๐ฒ๐ฟ๐๐ฎ๐ฏ๐ถ๐น๐ถ๐๐: Grafana, Prometheus, Azure Monitor โ ๐ฆ๐ฒ๐ฐ๐๐ฟ๐ถ๐๐ & ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ๐ถ๐ป๐ด: Load Balancers, Firewalls, ClusterIP โ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ป๐ด ๐ฆ๐๐๐๐ฒ๐บ๐: Linux, Mac ๐ก ๐๐ฒ๐ ๐ฆ๐๐ฟ๐ฒ๐ป๐ด๐๐ต๐ โ ๐๐น๐ผ๐๐ฑ ๐๐ฟ๐ฐ๐ต๐ถ๐๐ฒ๐ฐ๐๐๐ฟ๐ฒ & ๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป โ Designing and managing scalable cloud solutions โ ๐๐/๐๐ & ๐๐ฒ๐๐ข๐ฝ๐ ๐๐ฒ๐ฎ๐ฑ๐ฒ๐ฟ๐๐ต๐ถ๐ฝ โ Implementing robust and automated software delivery pipelines โ ๐ง๐ฒ๐ฎ๐บ ๐๐ฒ๐ฎ๐ฑ๐ฒ๐ฟ๐๐ต๐ถ๐ฝ & ๐ ๐ฒ๐ป๐๐ผ๐ฟ๐๐ต๐ถ๐ฝ โ Leading a 5-member team, fostering collaboration and growth โ ๐ฆ๐ฒ๐ฐ๐๐ฟ๐ถ๐๐ & ๐๐ผ๐บ๐ฝ๐น๐ถ๐ฎ๐ป๐ฐ๐ฒ โ Ensuring cloud security, compliance, and best practices โ ๐ฃ๐ฟ๐ผ๐ฏ๐น๐ฒ๐บ ๐ฆ๐ผ๐น๐๐ถ๐ป๐ด & ๐ข๐ฝ๐๐ถ๐บ๐ถ๐๐ฎ๐๐ถ๐ผ๐ป โ Driving efficiency through automation and DevOps practices โ ๐๐ผ๐ป๐๐ถ๐ป๐๐ผ๐๐ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด & ๐๐ป๐ป๐ผ๐๐ฎ๐๐ถ๐ผ๐ป โ Exploring emerging technologies and best practices