OpenShift Commands

Khemnath chauhan
1 min readFeb 12, 2024

--

The below are some of the important OpenShift command that will be used for managing the operations using CLI (oc).

#Add a specified role to a user with the add-role-to-user subcommand. 
$ oc policy [add-role-to-user] [role-name] username -n project

#For example, to add the user dev to the role basic-user in the wordpress project:
$ oc policy add-role-to-user basic-user dev -n wordpress

# Create a group called dev-group.
$ oc adm groups new dev-group

# Add the developer user to dev-group.
$ oc adm groups add-users dev-group developer

===============================================================

The “oc adm policy” command is used for administrative tasks related to policy management. (OpenShift cluster)

The “oc policy” command is used for managing policies and permissions at the project (namespace) level.

===============================================================

 ## Create a new secret named my-secret with keys for each file in folder bar
$ oc create secret generic my-secret --from-file=path/to/bar

## Create a new secret named my-secret using a combination of a file and a literal
$ oc create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret

--

--