Skip to content

Instantly share code, notes, and snippets.

@brunoa19
Created January 6, 2022 00:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brunoa19/86583c82b27fb1254fd047b87eba08e8 to your computer and use it in GitHub Desktop.
Save brunoa19/86583c82b27fb1254fd047b87eba08e8 to your computer and use it in GitHub Desktop.
echo "apiVersion: v1
kind: ServiceAccount
metadata:
name: shipa-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: shipa-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: shipa-admin
namespace: kube-system" \
| kubectl apply --filename -
echo
echo ----------------------------------
echo
echo Address:
kubectl cluster-info | grep 'Kubernetes' | awk '/http/ {print $NF}'
echo
echo Token:
kubectl --namespace kube-system \
get secret \
$(kubectl --namespace kube-system \
get secret \
| grep shipa-admin \
| awk '{print $1}') \
--output jsonpath="{.data.token}" \
| base64 --decode
echo
echo
echo CA Certificate:
kubectl get secret $(\
kubectl get secret \
| grep default-token \
| awk '{print $1}') \
--output jsonpath='{.data.ca\.crt}' \
| base64 --decode
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment