Skip to content

Latest commit

 

History

History
66 lines (53 loc) · 1.88 KB

Readme.md

File metadata and controls

66 lines (53 loc) · 1.88 KB

Setup Kubernetes Dashboard

The Kubernetes Dashboard is a useful tool to view and manage a kubernetes cluster. To install it, we need to do the following Dashboard Image

Install the Dashboard

# Install Kubernetes Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Setup Dashboard Service Account

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

Launch the Dashboard and Login

We simply run kubectl proxy. Once the proxy is running simply navigate to the following url

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

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