Kubernetes dashboard comes pre-installed on each PKS cluster. The following instructions are for how create credentials and obtain the access token. If there is an easier way, please let me know.
This command only needs to be run once.
cat <<EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system
EOF
- Display the access token:
name=$(kubectl -n kube-system get secret | grep kubernetes-dashboard-token | cut -c1-32)
kubectl -n kube-system describe secret $name | grep token
-
Copy the access token to the clipboard.
-
Run
kubectl proxy
. -
Access the dashboard at http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
-
Select token and paste the token you have saved in the clipboard
-
The dashboard can be used now.
-
When finished, Press CTRL-C to stop the proxy.