Skip to main content

CLI

OpenShift is accessible via CLI with a single binary called oc

This binary is downloadable here under the Download OpenShift Client Tools section.

On Mac's with HomeBrew you can run brew install openshift-cli

Once downloaded and extracted you can run oc help or take a look at our common used commands

Commonly used commands

CommandInfo
oc login https://server.addressLogin to the server
oc projectsList all OpenShift projects you have access to
oc project *project name*Switch current context to selected project
oc versionPrints local client version and version of the server logged in to
oc status --suggestPrints out status of a project and suggested fixes or changes
oc get podsList all project pods
oc get -o wide podsList all project pods with extended details
oc get -o yaml pod/*podname*Output the pod configuration as YAML for saving setup
oc rsh *podname*Remote shell (login) to a pod
oc logs -f *podname*Tail the logs from the pod
oc describe pod/*podname*Print out the configuration details
oc rsync /path/to/localdir *podname*:/remote/dirCopies local file to remote server (pod) path
oc rsync *podname*:/remote/dir /path/to/localdirCopies remote file to local path
oc port-forward *podname* 3333:3306Port forwards local port 3333 to remote pod port 3306