OpenShift Commonly Used Commands


oc login <urlWithToken>

Select project/namespace:

oc project <projectname>

Get all pods in a project

oc get pods

Port Forward a pod to localhost

oc port-forward <pod>

View logs of a pod

oc logs <pod>

Show status of a current project

oc status

Add users to namespace/project

oc adm policy add-role-to-group edit ocp_devs -n <project-namespace>

Copy File To Pod/Container

oc rsync <source> <destination>

Import Images to OpenShift

oc import-image <image> --from=<> --confirm

Image Stream Triggers (Mitch Murphey)

oc import-image <org>/<image>:<tag> --from=<> --confirm
oc new-app --docker-image=<org>/<image>:<tag>
oc set triggers dc/<image> --from-image=<org>/<image>:<tag> --auto=True -c=<image>

Link builder secrets (env)

oc secrets link builder openshift-private-ssh
oc new-app --source-secret openshift-private-ssh --name fe-clientside

Leave a Reply

Your email address will not be published. Required fields are marked *