OpenShift Operator
Overview
OpenShift is Kubernetes plus opinions: restricted SCCs, Routes, OLM-managed operators and a cluster version operator. Respect those opinions rather than fighting them.
When to use
- Deploy or debug apps on OpenShift/OKD, fix SCC denials, expose Routes.
- Install and upgrade operators via OLM.
- Cluster health, upgrades, node maintenance with
oc adm.
Engine
infra action=status (oc context, production flag), infra action=discover provider=openshift context=<ctx> (api-resources including CRDs).
infra action=graph op=impact node=<project> before cluster-level changes.
infra action=check every oc command; infra action=plan for upgrades and operator installs; infra action=run, infra action=verify.
Workflow
oc whoami --show-server, project, cluster version and cluster operators health.
- Workloads: pods/events, SCC assigned (
openshift.io/scc annotation), Routes and TLS termination.
- Operators: Subscription channel, InstallPlan approval Manual for prod, CSV phase.
- Upgrades:
oc adm upgrade to see paths, check Upgradeable conditions, MachineConfigPool progress.
Command families
oc whoami; oc whoami --show-server; oc project <p>; oc get projects
oc get clusterversion; oc get co; oc adm upgrade
oc get pods -o wide; oc get events --sort-by=.lastTimestamp; oc logs deploy/<d>
oc get route; oc create route edge <name> --service=<svc> --hostname=<host>
oc adm policy who-can use scc privileged; oc get pod <p> -o jsonpath='{.metadata.annotations.openshift\.io/scc}'
oc get subscriptions,csv,installplan -n <ns>; oc get packagemanifests -n openshift-marketplace
oc get mcp; oc adm cordon <node>; oc adm drain <node> --ignore-daemonsets --delete-emptydir-data
oc adm top nodes; oc adm must-gather
oc start-build <bc> --follow; oc get is
Safety rules
- Granting
anyuid/privileged SCC, cluster upgrades, approving InstallPlans, drains and MachineConfig changes are critical: user validation.
- Fix SCC denials by making the image run as non-root before granting SCCs.
- Production operators use Manual InstallPlan approval.
Verification and rollback
- Verify: cluster operators Available=True Degraded=False, MCPs Updated, Route answers over TLS, CSV Succeeded.
- Rollback:
oc rollout undo, previous CSV via subscription pinning, remove an SCC binding; cluster upgrades cannot be rolled back - plan them.
Deliverable
Cluster/operator health summary, changes with run ids, verification evidence, rollback.
1---2name: openshift-operator3description: Operate Red Hat OpenShift with oc - projects, routes, SecurityContextConstraints, builds and image streams, operators through OLM, cluster operators and upgrades with oc adm. Use for any OpenShift or OKD cluster task.4metadata:5 source: https://skillmd.com/skills/navinspire-ia/openshift-operator6 navin:7 emoji: 🎩8 category: devops9---1011# OpenShift Operator1213## Overview1415OpenShift is Kubernetes plus opinions: restricted SCCs, Routes, OLM-managed operators and a cluster version operator. Respect those opinions rather than fighting them.1617## When to use1819- Deploy or debug apps on OpenShift/OKD, fix SCC denials, expose Routes.20- Install and upgrade operators via OLM.21- Cluster health, upgrades, node maintenance with `oc adm`.2223## Engine24251. `infra action=status` (oc context, production flag), `infra action=discover provider=openshift context=<ctx>` (api-resources including CRDs).262. `infra action=graph op=impact node=<project>` before cluster-level changes.273. `infra action=check` every `oc` command; `infra action=plan` for upgrades and operator installs; `infra action=run`, `infra action=verify`.2829## Workflow30311. `oc whoami --show-server`, project, cluster version and cluster operators health.322. Workloads: pods/events, SCC assigned (`openshift.io/scc` annotation), Routes and TLS termination.333. Operators: Subscription channel, InstallPlan approval Manual for prod, CSV phase.344. Upgrades: `oc adm upgrade` to see paths, check `Upgradeable` conditions, MachineConfigPool progress.3536## Command families3738```bash39oc whoami; oc whoami --show-server; oc project <p>; oc get projects40oc get clusterversion; oc get co; oc adm upgrade41oc get pods -o wide; oc get events --sort-by=.lastTimestamp; oc logs deploy/<d>42oc get route; oc create route edge <name> --service=<svc> --hostname=<host>43oc adm policy who-can use scc privileged; oc get pod <p> -o jsonpath='{.metadata.annotations.openshift\.io/scc}'44oc get subscriptions,csv,installplan -n <ns>; oc get packagemanifests -n openshift-marketplace45oc get mcp; oc adm cordon <node>; oc adm drain <node> --ignore-daemonsets --delete-emptydir-data46oc adm top nodes; oc adm must-gather47oc start-build <bc> --follow; oc get is48```4950## Safety rules5152- Granting `anyuid`/`privileged` SCC, cluster upgrades, approving InstallPlans, drains and MachineConfig changes are critical: user validation.53- Fix SCC denials by making the image run as non-root before granting SCCs.54- Production operators use Manual InstallPlan approval.5556## Verification and rollback5758- Verify: cluster operators Available=True Degraded=False, MCPs Updated, Route answers over TLS, CSV Succeeded.59- Rollback: `oc rollout undo`, previous CSV via subscription pinning, remove an SCC binding; cluster upgrades cannot be rolled back - plan them.6061## Deliverable6263Cluster/operator health summary, changes with run ids, verification evidence, rollback.