Extract the Kubernetes Service Account Token for Authentication in the Command Center

Updated

On this page

Extract the token for the service account that you created to add the Kubernetes cluster in the Command Center.

Procedure

  • Use one of the following methods to extract the service account token:

    • Read the contents of the cv-test-account.config.kubeconfig file:

      #cat /root/cvrole_scripts/cv-test-account.config.kubeconfig
    • Fetch the token for the service account:

      kubectl describe secret -n namespace $(kubectl get secret -n namespace -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='cvbackup')].metadata.name}")

      For OpenShift, run the following command:

      oc sa get-token cvbackup -n namespace