k8s dashboard for kind

Luiz Gustavo De O. Costa
3 min readMay 22, 2021

It was a kind šŸ˜† of weird, handle all the Kubernetes (k8s) commands on my local environment and then I decided to install the k8s dashboard.

Expected result

What kind of problem the dashboard solve?

Solve the problem to see a GUI instead of CLI. Although help when youā€™re starting on k8s and/or wonā€™t have in mind all k8s commands, there are so many, check it out.

Assumptions

  • Has Helm installed
  • Youā€™re using kind
  • If youā€™re using other local k8s, such as Minikube check the section Minikube.

How to configure?

Install the dashboard using the following steps:

  1. Helm install
helm install dashboard kubernetes-dashboard/kubernetes-dashboard -n kubernetes-dashboard --create-namespace
helm install

2. Initiate the proxy

kubectl proxy
kubectl proxy

3. Access the login page

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:dashboard-kubernetes-dashboard:https/proxy/#/login
login page

4. Create an authentication token

For it, deploy the content below, saving it as file, such as service-account.yml

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

4.1 k8s create object

kubectl apply -f "file path + file name"
kubectl apply

4.2 Describe the user

The command below will describe the user, please pick the user that have this pattern ā€œadmin-user-token<>ā€, on the name ā€œTokensā€, in this example admin-user-token-lgr7w.

// First command
kubectl describe serviceaccount admin-user -n kubernetes-dashboard
// Second command
kubectl describe secret admin-user-token-lgr7w -n kubernetes-dashboard
kubectl describe

Copy the content starting on ā€œey..ā€ until ā€œ..Z1gā€, i.e., the token content.

5. Access

Choose the authentication by Token, and use the content copied from the previous step and past into the blank field, and hit the Sign in button.

6. Dashboard

After the steps, habemus access to dashboard, now itā€™s time to play šŸ’»

Dashboard
Dashboard Workloads

Minikube

For minikube click here.

References

--

--

Luiz Gustavo De O. Costa

Hey friend!! Iā€™m Luiz Gustavo, a Java developer and Iā€™m here to learn and write about Java, tests and good practices