Creating service accounts
You can create a service account in a project and grant it permissions by binding it to a role.
Procedure
-
Optional: To view the service accounts in the current project:
$ oc get saExample outputNAME SECRETS AGE builder 1 2d default 1 2d deployer 1 2d -
To create a new service account in the current project:
$ oc create sa <service_account_name>To create a service account in a different project, specify
-n <project_name>.Example outputserviceaccount "robot" createdYou can alternatively apply the following YAML to create the service account:
apiVersion: v1 kind: ServiceAccount metadata: name: <service_account_name> namespace: <current_project> -
Optional: View the secrets for the service account:
$ oc describe sa robotExample outputName: robot Namespace: project1 Labels: <none> Annotations: openshift.io/internal-registry-pull-secret-ref: robot-dockercfg-qzbhb Image pull secrets: robot-dockercfg-qzbhb Mountable secrets: robot-dockercfg-qzbhb Tokens: <none> Events: <none>