← All insightsCheat Sheet

Red Hat OpenShift cheat sheet: the complete command reference

CodeWizard Engineering · 26 July 2025 · 3 min read · Beginner

This is a complete, hands-on Red Hat OpenShift cheat sheet: install, configure, operate, automate and secure it - with copy-paste commands grouped by task. Bookmark it for day-to-day work, incidents and interviews alike.

OpenShift is Red Hat's enterprise Kubernetes distribution, adding integrated CI/CD (Pipelines/Tekton), image builds, stricter security defaults (SCCs), a developer console and a curated operator ecosystem.

Why you reach for it

  • Batteries-included enterprise Kubernetes
  • Stronger secure-by-default posture (SCCs, non-root)
  • Integrated builds, pipelines and a developer console

Installation

bash
# Local single-node cluster
crc setup && crc start
oc login -u developer https://api.crc.testing:6443

Configuration reference

A Route exposing a Service over HTTPS.

yaml
apiVersion: route.openshift.io/v1
kind: Route
metadata: { name: web }
spec:
  to: { kind: Service, name: web }
  port: { targetPort: 3000 }
  tls: { termination: edge }

Core commands you use daily

bash
oc new-app ghcr.io/acme/web:1.0
oc expose svc/web
oc get routes

Projects & apps

bash
oc login -u developer https://api.crc.testing:6443
oc new-project demo
oc new-app ghcr.io/acme/web:1.0
oc expose svc/web
oc get routes
oc rollout status deploy/web

Admin & debug

bash
oc get pods -o wide
oc logs -f deploy/web
oc adm policy add-scc-to-user anyuid -z default
oc describe route web

Use it in CI/CD

Build from source in-cluster with a BuildConfig.

yaml
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata: { name: web }
spec:
  source: { git: { uri: https://github.com/acme/web } }
  strategy: { type: Docker }
  output: { to: { kind: ImageStreamTag, name: 'web:latest' } }

Best-practice checklist

  • Work with SCCs - run non-root and drop capabilities
  • Use ImageStreams + DeploymentConfigs/Deployments for rollouts
  • Adopt OpenShift Pipelines (Tekton) for CI/CD

Common pitfalls to avoid

  • Fighting Security Context Constraints by running privileged
  • Ignoring ImageStreams and losing automatic rollouts
  • Treating it exactly like vanilla k8s and skipping oc tooling

Security quick wins

  • Keep the restrictive default SCC; avoid privileged pods
  • Use built-in OAuth and per-project RBAC

Works well with

  • Kubernetes - Declarative orchestration for containers at scale - self-healing, rolling updates and service discovery.
  • Helm - The package manager for Kubernetes - template, version and release your manifests as charts.
  • Argo CD - GitOps continuous delivery for Kubernetes - Git is the source of truth, the cluster is reconciled to match.
A cheat sheet is muscle memory on paper - keep it close until the commands live in your fingers.

Want senior help putting Red Hat OpenShift to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult