Recently I started exploring Kubernetes and tried to deploy the dashboard UI. Here is the list of steps followed to setup dashboard for my kubernetes cluster.
1. Refer to https://github.com/kubernetes/dashboard to get latest YAML file to setup dashboard. Run following command on your master node to deploy latest dashboard.
2. Run below command to view the deployed dashboard details
3. Create a dashboard-admin-service-account.yaml file with below content.
4. Run the dashboard-admin-service-account.yaml file to perform following actions.
5. Run below command to get token for the dashboard-user user. This is required to login to dashboard.
6. Run below command to access Dashboard from your local workstation you must create a secure channel to your Kubernetes cluster
7. Setup SSH tunneling via Putty. This step is not required, if you are accessing browser on same host.
8. Open browser and access below URL.
9. Select Token and copy the token output from step#6 into Enter token field on login screen.. Click on Sign in button.
10. Dashboard will be displayed.
1. Refer to https://github.com/kubernetes/dashboard to get latest YAML file to setup dashboard. Run following command on your master node to deploy latest dashboard.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc5/aio/deploy/recommended.yaml
2. Run below command to view the deployed dashboard details
kubectl get services --all-namespaces -o wide kubectl get deployments --all-namespaces -o wide kubectl get pods --all-namespaces -o wide kubectl -n kubernetes-dashboard describe pod kubernetes-dashboard kubectl -n kubernetes-dashboard describe pod dashboard-metrics-scraper
3. Create a dashboard-admin-service-account.yaml file with below content.
apiVersion: v1
kind: ServiceAccount
metadata:
name: dashboard-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dashboard-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: dashboard-user
namespace: kubernetes-dashboard
4. Run the dashboard-admin-service-account.yaml file to perform following actions.
- Create Service Account with name dashboard-user in namespace kubernetes-dashboard first.
- Create ClusterRoleBinding for ServiceAccount
kubectl apply -f dashboard-admin-service-account.yaml
5. Run below command to get token for the dashboard-user user. This is required to login to dashboard.
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep dashboard-user | awk '{print $1}') | grep token:
6. Run below command to access Dashboard from your local workstation you must create a secure channel to your Kubernetes cluster
kubectl proxy
7. Setup SSH tunneling via Putty. This step is not required, if you are accessing browser on same host.
8. Open browser and access below URL.
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
9. Select Token and copy the token output from step#6 into Enter token field on login screen.. Click on Sign in button.
10. Dashboard will be displayed.