Introduction to “oc” — the OpenShift Command Line Power Tool

Benjamin Porter
14 min readJan 8, 2021
Photo by Marissa Daeger on Unsplash

If you use Kubernetes/OpenShift in any capacity, you have no doubt seen commands that start with oc being used to interact with the system. The oc tool can do a lot, and is pretty intuitive to use once you understand a few things.

I’m going to give a brief background/overview here about Kubernetes/OpenShift and then get into what oc does and how to use it. From this point on I will just refer to "OpenShift" and oc, but the vast majority of this article will also apply to Kubernetes and kubectl.

OpenShift has a RESTful API that is used for configuration

At the heart of OpenShift is an etcd database that contains a bunch of object which define the current and desired state of the system. The object types are defined by controllers that operate on them. Much like any application, each object type is a representation of a real world thing. In the case of OpenShift it is container infrastructure that is being represented: containers, load balancers, routers, that sort of thing. The API is highly extensible so there is no limit to the number of types and objects you use or create.

--

--

Benjamin Porter

Ben Porter is a Software Engineer who specializes in distributed applications (like web apps). He is currently Chief Technology Officer (CTO) at Ameelio.org