Kubernetes Dashboard
How to setup Kubernetes Dashboard
Installing the Dashboard gives you a useful window especially if you are new and trying to work out what is happening.
First think check out what is the latest version of the Dashboard. I have selected v2.0.1. Kubernetes has a very fast release schedule. Don’t be the first, but don’t delay either. Just update the version embeded in the command below. Go here for the latest releases https://github.com/kubernetes/dashboard/releases
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.1/aio/deploy/recommended.yaml
Then you need to create the rights for the Dashboard to access Kubernetes.
Create User and Rights by the below command. You can create the two files as a Yaml file if you wish and run it that way.
kubectl apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
EOF
kubectl apply -f - <<EOF
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
EOF
Now the clever bit. You run a proxy server giving you a pipe into the system. This will open up a connection on your machine on port 8001.
kubectl proxy
Thus opening up this http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/. will now open up the page.
The first thing that will hit you is a request for a password or token. Token is the best way to go.
So in another terminal (your proxy will be running in the other or you can run it in the background)
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
Copy the token and paste in as a password for the dashboard.
You have access now to the Kubernetes Dashboard.

Share this post
Twitter
Google+
Reddit
LinkedIn
Email