Creating a Service Account for the Kubernetes Cluster Role

To create a service account and bind it to the cluster role, you can use the command line.

When you add the Kubernetes cluster in the Command Center to protect applications, you must use this cluster role.

Procedure

  1. Create a service account:

    kubectl create sa user_name

  2. Create a cluster role binding for the service account with the cluster role.

    kubectl create clusterrolebinding user_name-binding --clusterrole=cluster_role_name --serviceaccount=namespace:user_name

  3. Fetch the token for the service account that you created.

    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

Loading...