0
0
Kubernetesdevops~5 mins

Kubernetes dashboard - Commands & Configuration

Choose your learning style9 modes available
Introduction
Managing many applications and resources in Kubernetes can be hard using only commands. The Kubernetes dashboard is a web interface that helps you see and control your cluster easily without typing many commands.
When you want to quickly check the status of your pods, deployments, and services visually.
When you need to troubleshoot issues by looking at logs and events in one place.
When you want to create or update Kubernetes resources without writing YAML files manually.
When you prefer a graphical interface to monitor resource usage like CPU and memory.
When you want to give team members a simple way to view and manage the cluster without deep command-line knowledge.
Commands
This command installs the Kubernetes dashboard by applying the official dashboard manifest to your cluster.
Terminal
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
Expected OutputExpected
namespace/kubernetes-dashboard created serviceaccount/kubernetes-dashboard created service/kubernetes-dashboard created secret/kubernetes-dashboard-certs created secret/kubernetes-dashboard-csrf created secret/kubernetes-dashboard-key-holder created configmap/kubernetes-dashboard-settings created role.rbac.authorization.k8s.io/kubernetes-dashboard created rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created deployment.apps/kubernetes-dashboard created service/dashboard-metrics-scraper created deployment.apps/dashboard-metrics-scraper created
This command starts a proxy to securely access the dashboard locally through your browser.
Terminal
kubectl proxy
Expected OutputExpected
Starting to serve on 127.0.0.1:8001
This command generates a login token for the dashboard to authenticate you securely.
Terminal
kubectl -n kubernetes-dashboard create token admin-user
Expected OutputExpected
eyJhbGciOiJSUzI1NiIsImtpZCI6IjYzYzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5YzY5In0.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXRzZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvdXNlcm5hbWUiOiJhZG1pbi11c2VyIiwic3ViIjoiYWNjb3VudDprdWJlcm5ldGVzLWRhc2hib2FyZDphZG1pbi11c2VyIn0.XYZ1234567890abcdef
Open this URL in your browser to access the Kubernetes dashboard through the proxy.
Terminal
open http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
Expected OutputExpected
No output (command runs silently)
Key Concept

If you remember nothing else from this pattern, remember: the Kubernetes dashboard gives you a simple web view to manage and monitor your cluster without complex commands.

Common Mistakes
Trying to access the dashboard URL directly without running 'kubectl proxy'.
The dashboard is not exposed publicly by default, so direct access is blocked for security.
Always run 'kubectl proxy' first to create a secure local tunnel to the dashboard.
Not creating or using a valid login token to sign in to the dashboard.
Without a token, you cannot authenticate and access the dashboard features.
Generate a token with 'kubectl -n kubernetes-dashboard create token admin-user' and use it to log in.
Applying an outdated or incorrect dashboard manifest URL.
This can cause installation failures or install an insecure or incompatible dashboard version.
Use the official and latest stable dashboard manifest URL from the Kubernetes GitHub repository.
Summary
Install the Kubernetes dashboard using the official manifest with 'kubectl apply'.
Start a local proxy with 'kubectl proxy' to securely access the dashboard in your browser.
Generate a login token to authenticate and use the dashboard safely.
Open the dashboard URL through the proxy to view and manage your cluster visually.