Skip to content

OpenShift Container Platform (OCP)

OpenShift Container Platform (OCP) is Red Hat’s distribution of Kubernetes. Alongside the standard Kubernetes objects it adds a build and image-promotion pipeline of its own, which is what the chain below describes. This page covers the source-to-running-pod path; it is not about the open/closed principle, which the handbook also abbreviates OCP in a software design context.

  1. BuildConfig defines how source becomes an image. It references the Git repository to build from and the ImageStream to push the result to, and it carries triggers — typically a webhook fired by the repository on push, plus image-change and config-change triggers — that decide when a build starts.
  2. The BuildConfig starts a build pod. That pod checks out the repository and produces an application image.
  3. The image is pushed to the ImageStream, which now points at the new image. An ImageStream is a named, tagged pointer to images rather than a registry of its own: it decouples “the current build of this application” from any particular image digest.
  4. The Deployment watches the ImageStream tag. A new image triggers a rolling update. The Deployment also owns the properties the application pods are created with — replica count, resource requests and limits, environment, probes.
  5. A Service gives the pods one stable cluster-internal address and load-balances across whichever of them are currently ready.
  6. A Route maps a fully qualified external hostname to a Service, and terminates TLS for it. Routes are OpenShift’s ingress object.
Terminal window
oc projects # list the projects you can see
oc project [myProject] # switch the current project
oc get all # everything in the current project
oc describe [bc|svc|deploy]/[name] # full detail for one object
Terminal window
oc status # what is broken in this project
oc get events --sort-by=.lastTimestamp # recent cluster events, oldest first
oc logs -f [pod] # follow a pod's logs
oc logs -f bc/[name] # follow the current build's logs
oc edit [type]/[name] # edit a live object

The short name for a Service is svc:

Terminal window
oc expose svc/[SERVICE-NAME]
oc get route