Kubernetes dashboard UI

Add user and configure permissions

cat <<EOF> /tmp/dashboard-adminuser.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system
EOF
kubectl apply -f /tmp/dashboard-adminuser.yaml
cat <<EOF> /tmp/kubernetes-dashboard-admin.rbac.yaml
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
EOF
kubectl apply -f /tmp/kubernetes-dashboard-admin.rbac.yaml

Get dashboard token

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token: | awk '{print $2}'

Start proxy and open Kubernetes Dashboard

CLUSTER=foo-k8s-cluster1
CLUSTER_IP=$(openstack coe cluster show ${CLUSTER} -c master_addresses -f value | cut -d"'" -f2)
echo ${CLUSTER_IP}
 
#ssh -L 8001:localhost:8080 fedora@10.0.10.111
ssh -L 8001:localhost:8080 fedora@${CLUSTER_IP}
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
 
kubectl proxy

Kubernetes Dashboard URL
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Links
https://github.com/kubernetes/dashboard/wiki/Creating-sample-user
https://www.twblogs.net/a/5c4adb6fbd9eee6e7e06a9b0
https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
https://github.com/kubernetes/dashboard/wiki/Access-control#admin-privileges