1
0
mirror of https://github.com/jcwimer/kubernetes-ansible synced 2026-03-25 00:54:44 +00:00

Added script to get kubernetes dashboard user key

This commit is contained in:
2019-02-12 09:24:12 -05:00
parent 14b2a8542a
commit 0cef5651c4

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# https://blog.heptio.com/on-securing-the-kubernetes-dashboard-16b09b1b7aca
# kubectl -n kube-system edit service kubernetes-dashboard
# Change dashboard to node port
kubectl -n kube-system get service kubernetes-dashboard -o yaml | \
sed 's/type: ClusterIP/type: NodePort/g' | \
kubectl apply -f -
# Create the service account in the current namespace
# (we assume default)
kubectl create serviceaccount my-dashboard-sa
# Give that service account root on the cluster
kubectl create clusterrolebinding my-dashboard-sa \
--clusterrole=cluster-admin \
--serviceaccount=default:my-dashboard-sa
# Get secret token
kubectl describe secret $(kubectl get secret | grep my-dashboard-sa | awk '{print $1}') | grep 'token:' | awk {'print $2'}