OpenShift CLI
$ oc Official High RiskRed Hat's OpenShift CLI (oc) wraps and extends kubectl with OpenShift Projects, Routes, BuildConfigs, and ImageStreams. It supports -o json, -o jsonpath, --dry-run=client|server, and oc status.
brew install openshift-cli oc mirrors kubectl grammar with -o json, -o jsonpath, and --dry-run=server, giving agents complete OpenShift coverage without MCP overhead.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Inherits kubectl -o json, -o jsonpath, --dry-run=client|server, and oc explain, though commands like oc new-app can print text warnings to stdout alongside JSON.
- Supports
-o json,-o jsonpath, and--dry-run=server oc new-app -o jsoncan emit non-JSON warning text on stdout
Supports server-side dry-run and oc auth can-i, though oc login can prompt interactively and cluster-scoped edits carry high impact.
- Server-side
--dry-run=serverand RBACoc auth can-i
Static Go binary distributed via Homebrew (openshift-cli) and Red Hat/OKD mirrors for macOS, Linux, and Windows.
- Cross-platform binary via
brew install openshift-cli
Single CLI covers both standard Kubernetes resources and OpenShift-specific Routes, Builds, and Operators.
- Unified
kubectl+ OpenShift workflow
Official Red Hat / OKD repository (openshift/oc) maintained in lockstep with OpenShift releases under Apache-2.0.
- Official
openshift/ocunder Apache-2.0
Comprehensive Red Hat / OKD CLI reference docs and built-in oc explain / --help.
- OKD and Red Hat CLI reference documentation
Security, Auth & Guardrails
Stores cluster tokens and contexts in ~/.kube/config (KUBECONFIG) via oc login.
CLI is Apache-2.0 open-source; OpenShift cluster usage depends on OKD or commercial Red Hat subscriptions.
# OpenShift CLI (oc) Agent Rules - Always verify `oc whoami` and pass `-n <project>` explicitly on commands. - Use `--dry-run=client` or `--dry-run=server` with `oc apply`/`oc new-app` before mutating clusters. - Pass `--token` non-interactively instead of calling interactive `oc login` prompts.
Agent-Ready Command Recipes
Safe Read-Only Queries
oc whoami && oc project -q && oc status
Verifies active identity, project namespace, and workload summary before running mutations.
oc get routes -n my-app -o json
Retrieves OpenShift Route hostnames and TLS configuration in structured JSON.
Controlled Writes & Previews
--dry-run=client oc new-app quay.io/example/app:latest -n staging --dry-run=client -o json
Generates the Deployment, Service, and ImageStream JSON locally without creating cluster resources.
Strengths for Agents
- + Full
kubectlcompatibility (-o json,-o jsonpath,--dry-run=server,explain). - + Native support for OpenShift Routes, Projects, BuildConfigs, and
oc admdiagnostics. - + Cross-platform single binary maintained directly by Red Hat.
Caveats & Pitfalls
- !
oc loginwithout--tokentriggers interactive credential prompts that block headless shells. - ! Commands such as
oc new-appmay prepend human-readable warning lines before JSON output.