Created
September 24, 2019 10:51
-
-
Save wickedev/9416f1856a112976aacae8782cc633db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl config view --raw \ | |
-o=jsonpath='{.clusters[0].cluster.certificate-authority-data}' \ | |
| base64 --decode | |
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: gitlab-admin | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: gitlab-admin | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-admin | |
subjects: | |
- kind: ServiceAccount | |
name: gitlab-admin | |
namespace: kube-system | |
EOF | |
SECRET=$(kubectl -n kube-system get secret | grep gitlab-admin | awk '{print $1}') | |
TOKEN=$(kubectl -n kube-system get secret $SECRET -o jsonpath='{.data.token}' | base64 --decode) | |
echo $TOKEN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment