How Do I Set Up and Access the Kuberentes Dashboard
The Kubernetes Dashboard is a tool used to manage and deploy items to the cluster. It can also be used to debug any issues you may run into in operating your cluster.
kubectl must be configured prior to proceeding with this guide.
Deploying the Dashboard
the Dashboard can be deployed in one command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
How to Access the Dashboard
By default, the Dashboard is deployed with a minimum RBAC configuration to protect your cluster. You will need to create a user to log into the Dashboard.
Warning: The sample user created in the tutorial will have administrative privileges and is for educational purposes only.
Creating a User/Service Account
IMPORTANT: Make sure that you know what you are doing before proceeding. Granting admin privileges to Dashboard's Service Account might be a security risk.
First, create the service account:
kubectl create serviceaccount admin -n kubernetes-dashboard
Create a ClusterRoleBinding for the service account:
cat <<EOF | kubectl apply -f -
- kind: ServiceAccount
Get the Bearer Token
Use the following command to create the token used to access the dashboard:
kubectl -n kubernetes-dashboard create token admin
Copy the output as you will use it in a moment.
Proxy to the Dashboard
To access the Dashboard, you need to proxy the Dashboard so your web browser can access it.
Next open your favorite web browser and open the following URL the proxy has made available:
You may see an error saying this is not a secured site. You can accept the risks to continue
Next, you need to input the Bearer Token you created earlier:
Congratulations you can now use the Kubernetes Dashboard.