0
0
Kubernetesdevops~30 mins

Kubernetes dashboard - Mini Project: Build & Apply

Choose your learning style9 modes available
Kubernetes dashboard
📖 Scenario: You are managing a Kubernetes cluster and want to set up the Kubernetes dashboard. This dashboard helps you see and manage your cluster resources visually through a web interface.
🎯 Goal: Set up the Kubernetes dashboard by deploying it, create a service account with admin rights, and access the dashboard using a secure token.
📋 What You'll Learn
Deploy the Kubernetes dashboard using the official YAML manifest
Create a service account named admin-user in the kubernetes-dashboard namespace
Bind the admin-user service account to the cluster-admin role
Retrieve the login token for the admin-user service account
Start the dashboard proxy to access the dashboard
💡 Why This Matters
🌍 Real World
Kubernetes dashboard is widely used by cluster administrators to monitor and manage cluster resources visually without using complex command-line commands.
💼 Career
Knowing how to deploy and secure the Kubernetes dashboard is a key skill for DevOps engineers and Kubernetes administrators to provide easy cluster management and troubleshooting.
Progress0 / 4 steps
1
Deploy the Kubernetes dashboard
Run the command kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml to deploy the Kubernetes dashboard in your cluster.
Kubernetes
Need a hint?

This command downloads and applies the official dashboard manifest to your cluster.

2
Create the admin-user service account
Create a service account named admin-user in the kubernetes-dashboard namespace by running kubectl create serviceaccount admin-user -n kubernetes-dashboard.
Kubernetes
Need a hint?

This creates a user that the dashboard can use to authenticate.

3
Bind admin-user to cluster-admin role
Bind the admin-user service account to the cluster-admin role by running kubectl create clusterrolebinding admin-user-binding --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:admin-user.
Kubernetes
Need a hint?

This gives the admin-user full permissions to manage the cluster via the dashboard.

4
Get the admin-user token and start dashboard proxy
Run these two commands: kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 --decode to get the token, then kubectl proxy to start the proxy. Print the token value as output.
Kubernetes
Need a hint?

The token lets you log in to the dashboard. The proxy command lets you access the dashboard securely on your local machine.