This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.7.2. 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 sa
$ oc get sa
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME SECRETS AGE builder 2 2d default 2 2d deployer 2 2d
NAME SECRETS AGE builder 2 2d default 2 2d deployer 2 2d
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To create a new service account in the current project:
oc create sa <service_account_name>
$ oc create sa <service_account_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- To create a service account in a different project, specify
-n <project_name>
.
Example output
serviceaccount "robot" created
serviceaccount "robot" created
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: View the secrets for the service account:
oc describe sa robot
$ oc describe sa robot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow