From NovaOrdis Knowledge Base
Jump to navigation Jump to search




oc is the OpenShift remote client that talks with the master API server. Intended for regular users. The cluster administrator's CLI interface is oadm. For more details on CLI tool configuration and context see:

OpenShift Command Line Tools

oc and kubectl

Because OpenShift is a certified Kubernetes distribution, kubectl binaries that ship with OpenShift can be used with the cluster. The oc binary offers extended functionality.


Make sure to upgrade the client if the server is upgraded.


If a new RHEL node needs to be enabled to allow access to an OpenShift environment, and the entire OpenShift set of packages was not installed, only OpenShift clients can be installed as part of the atomic-openshift-clients package:

yum install atomic-openshift-clients

If you get:

No package '''atomic-openshift-clients''' available.
Error: Nothing to do

that means that either the host has no access to an OpenShift subscription, and, in consequence, no access to the appropriate repository, or that the "atomic-openshift-excluder" package was previously installed, and an "unexclude" command must be executed, as described here: OpenShift Yum Excluders.


Download from https://access.redhat.com/downloads/content/290, choose "OpenShift v3.5 MacOSX Client". Then extract the content and place "oc" in PATH.

Azure OpenShift oc for Mac

Azure OpenShift oc for Mac | Installation

Namespace Selection

CLI Tools Namespace Selection


In general, all oc commands can be configured to send their output in either JSON or YAML format, rather than execute the command.

This is achieved with

oc ... -o json|yaml

In case of oc get, the output of the server execution is rendered in JSON/YAML if -o json|-o yaml is used.

Logging and Debugging

oc ... --loglevel=8

This log level shows the API requests made with each command.

The curl commands used to send the requests are displayed with:

oc --loglevel=10 ...




Set Context

Create, Update and Delete Resources

Pod/Container Tools