- Set your kubectl context against your TKG Management cluster
- Create a service account and needed RBAC using the bellow commands:
kubectl create ns terasky-monitoring
kubectl create sa -n terasky-monitoring terasky-monitoring-user
kubectl create clusterrolebinding terasky-monitoring-rbac --serviceaccount terasky-monitoring:terasky-monitoring-user --clusterrole view
- create the token for the service account using the bellow command
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: terasky-monitoring-user-token
namespace: terasky-monitoring
annotations:
kubernetes.io/service-account.name: terasky-monitoring-user
type: kubernetes.io/service-account-token
EOF
- Retrieve the generated token using the bellow command
kubectl get secret -n terasky-monitoring terasky-monitoring-user-token -o jsonpath='{.data.token}' | base64 --decode