Development Kubernetes cluster with Kind (3) - Dashboard
Publicado: 2022-07-08
Other posts in this series:
The following commands install the Dashboard using the official Helm chart, and get the credentials to access the console using a web browser:
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm repo update
helm show chart kubernetes-dashboard/kubernetes-dashboard
helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --wait --namespace kubernetes-dashboard --create-namespace --version ^5.7.0
kubectl -n kubernetes-dashboard wait --for=condition=ready --timeout=600s pod --selector=app.kubernetes.io/component=kubernetes-dashboard
cat <<'EOF' | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: dashboard-admin
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dashboard-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: dashboard-admin
namespace: kubernetes-dashboard
EOF
TOKEN=$(kubectl -n kubernetes-dashboard create token dashboard-admin)
echo -e "Dashboard: \nURL: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:https/proxy/#/login \nToken: ${TOKEN}"
kubectl proxy
You can access the Dashboard using the URL and token printed by the previous commands.