OpenShift: Resource management Cheat Sheet

# Create a new application from source code, container
image, or OpenShift template

oc new-app

# Create a new build configuration from source code

oc new-build

# Add/update/remove annotations from an Openshift resource

oc annotate

# Create a new resource from filename or stdin

oc create

# Retrieve a resource (use -o for additional output options)

oc get

# Replace an existing resource from filename or stdin

oc replace

# Delete a resource

oc delete

# Modify a resource from text editor

oc edit

# Retrieve a resource with details

oc describe

OpenShift: Cluster Management Cheat Sheet

# Administrative functions for an Openshift cluster

oc adm

# Install a router or registry

oc adm router|registry

# Manage role/ SCC to user/group bindings, as well as additional policy administration

oc adm policy

# Run tests/validation against a cluster

oc adm diagnostics

# Unschedule/ schedule/ drain a node

oc adm cordon/uncordon/drain

# Manage groups

oc adm groups

# Show usage statistics of resources

oc adm top

OpenShift: Additional Resource Cheat Sheet

# Update fields for a resource with JSON or YAML segments

oc patch

# Get configmaps or secrets and save to disk

oc extract

# Modify miscellaneous application resources

oc set

# Add a readiness/liveness probe on pod template/deployment configuration

oc set probe

# Manage volume types on a pod template/deployment configuration

oc set volumes

# Set a script/command to execute as part of the build process

oc set build-hook

# Set a secret to be included as part of the build process

oc set build-secret

# Set environment variables on a pod template/deployment
configuration/build configuration

oc set env

# Update the image for deployment configurations/ daemonsets

oc set image

# Set triggers for deployment configurations/build configurations

oc set triggers

OpenShift: Operational Cheat Sheet

# Retrieve the logs for a resource (build configurations, deployment configurations, and pods)

oc logs

# Remote shell into a container

oc rsh

# Copy files to or from a container

oc rsync

# Execute a command in a container

oc exec

# Create a deployment configuration from image

oc run

# Scale resources to zero replicas

oc idle

# Display an introduction to some core OpenShift concepts

oc types

# Log in to the OpenShift server

oc login

# End the current session

oc logout

# Create a new project

oc new-project <project_name>

# Show an overview of the current project

oc status

OpenShift: Build and Deploy Cheat Sheet

# Manage deployments from deployment configuration

oc rollout

# Start a new deployment with the latest state

oc rollout latest

# Perform a rollback operation

oc rollout undo

# View historical information for a deployment configuration

oc rollout history

# Watch the status of a rollout until complete

oc rollout status

# Tag existing images into image streams

oc tag

# Start a new build from a build configuration

oc start-build

# Cancel a build in progress

oc cancel-build

# Pull in images and tags from an external Docker registry

oc import-image

# Change the number of pod replicas for a deployment

oc scale