Skip to content

Instantly share code, notes, and snippets.

@vrabbi
Created March 12, 2024 16:01
Show Gist options
  • Select an option

  • Save vrabbi/fd9f66f657004bc28711c70174dd7813 to your computer and use it in GitHub Desktop.

Select an option

Save vrabbi/fd9f66f657004bc28711c70174dd7813 to your computer and use it in GitHub Desktop.
  1. Set your kubectl context against your TKG Management cluster
  2. 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
  1. 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
  1. Retrieve the generated token using the bellow command
kubectl get secret -n terasky-monitoring terasky-monitoring-user-token -o jsonpath='{.data.token}' | base64 --decode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment