Skip to content

Instantly share code, notes, and snippets.

@tyrion70
Created November 26, 2019 19:23
Show Gist options
  • Select an option

  • Save tyrion70/8f795d96b6484bea1c76889f790efb4f to your computer and use it in GitHub Desktop.

Select an option

Save tyrion70/8f795d96b6484bea1c76889f790efb4f to your computer and use it in GitHub Desktop.
# enable dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta6/aio/deploy/recommended.yaml
# create user
cat > dashboard-adminuser.yml <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
EOF
# create role
cat > admin-role-binding.yml <<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: kube-system
EOF
# actually create stuff on k8
kubectl apply -f dashboard-adminuser.yml
kubectl apply -f admin-role-binding.yml
# To get token get (copy the token)
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
# to start the dashboard on port 8001
kubectl proxy
# ssh to your server with ssh port forwarding
ssh root@<server> -L 8001:127.0.0.1:8001
# To open dashboard goto
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
# ENJOY :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment