Skip to content

Instantly share code, notes, and snippets.

@gyfoster
Last active April 8, 2019 15:15
Show Gist options
  • Save gyfoster/092463dd15ab1e6514f21fefa9464ba3 to your computer and use it in GitHub Desktop.
Save gyfoster/092463dd15ab1e6514f21fefa9464ba3 to your computer and use it in GitHub Desktop.
A list of commonly used OpenShift CLI commands
Roll back deployment to previous version:
$ oc rollback <app-name> --to-version=<deployment-num>
Get access to pod where it fails:
$ oc debug <pod-name>
Create image stream from image in external registry:
$ oc import-image <image-name> --from=nexus.my-domain.com:5000/<image-name> --confirm
View logs relating to build:
$ oc logs build/<build-name>
SSH into pod remotely:
$ oc rsh <pod>
List pods:
$ oc get pods
List all resources containing text:
$ oc get all -o name | grep <text>
List all resources pertaining to app:
$ oc get all -l app=<app-name>
Delete all resources pertaining to app:
$ oc delete all -l app=<app-name>
Deploy image from remote registry:
$ oc new-app my-registry:5000/<image-name>
Expose route:
$ oc expose svc/<image-name> --hostname=<image-name>.my-domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment