The Kubernetes Dashboard is a useful tool to view and manage a kubernetes cluster. To install it, we need to do the following
# Install Kubernetes Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
This is the account information that the dashboard will use to access your cluster resources. Typically you want this to be of the cluster-admin
role
First, create a file called admin-user.yaml
and paste the following in
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
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: kube-system
---
apiVersion: v1
kind: Secret
metadata:
name: admin-user
namespace: kube-system
annotations:
kubernetes.io/service-account.name: "admin-user"
type: kubernetes.io/service-account-token
Then we apply it
# Install Kubernetes Dashboard User
kubectl apply -f admin-user.yaml
We simply run kubectl proxy
. Once the proxy is running simply navigate to the following url
In order to login we need to get the token for the account we created using the following
# Get dashboard token
kubectl get secret admin-user -n kube-system -o jsonpath={".data.token"} | base64 -d