Platform Engineering · Lesson 103

OpenShift Operations: Upgrades, MachineConfig, OLM Operators, and Recovery

An OpenShift cluster is run by operators, including the operators that run OpenShift itself. The Cluster Version Operator upgrades the platform by rolling every cluster operator to a new release, the Machine Config Operator rolls the operating system and node configuration through MachineConfigPools one batch of nodes at a time, and the Operator Lifecycle Manager installs and upgrades add-on operators from catalogs. This lesson follows one z-stream upgrade from choosing the version to every node rebooted, and shows how a PodDisruptionBudget can stall it for hours and a removed API can stop it from starting at all.

Difficulty: Advanced · Know this first: Lesson 102, Lesson 101, Lesson 99

Run it as:

When it breaks, I check

One thing to remember

Where the time goes

This bar splits one upgrade, in minutes. It is a worked example, not a measurement. The worker pool is the biggest slice in a healthy upgrade; a blocked drain or a late migration can be bigger than all the rest.

Try it: how long will the worker pool take?

Set the number of workers, maxUnavailable for the pool, and the minutes one node takes to drain, reboot, and become Ready. The pool updates in batches.

batches = ceil(workers ÷ maxUnavailable) · pool time = batches × minutes per node · capacity online = (workers − maxUnavailable) ÷ workers

6batches
84 minworker pool
83%capacity online

Fits a maintenance window with capacity to spare

Check yourself

Three questions. No score is saved anywhere — this is just you against the material.

Basic to master

OpenShift operations grow in four levels: first the operators that run the platform, then routine upgrades and node configuration, then minor upgrades, OLM, and recovery, and finally running a fleet of clusters.

Basic — The operators that run OpenShift

At the basic level you know who does what. The Cluster Version Operator (CVO) owns the platform version. Cluster operators each own one component (oc get co). The Machine Config Operator owns the node OS and configuration through MachineConfigPools (master, worker, and custom pools). OLM installs add-on operators from catalogs.

Terms: channel, update graph, z-stream (4.16.21 → 4.16.24), minor (4.16 → 4.17), EUS, MachineConfig, RHCOS, Subscription, CSV, InstallPlan.

Where it breaks: editing node files by hand; the MCO reverts them or marks the pool Degraded. Change nodes through MachineConfig.

Try it: Basic

You need to change a sysctl on every worker node. How?

Now do it: Run oc get mcp and oc get mc on a cluster you can read, and find which MachineConfigs make up the worker pool.

Intermediate — Routine upgrades and node changes

At the intermediate level you run z-stream upgrades and node changes safely.

  • Before: cluster operators healthy, etcd backup (cluster-backup.sh on a control-plane node), PDBs that allow at least one disruption, spare capacity for draining.
  • During: oc adm upgrade, oc get co, oc get mcp; maxUnavailable per pool chosen from capacity.
  • Custom pools (for example infra or GPU nodes) to update groups of nodes separately, and pausing a pool to control when it reboots.

Troubleshooting: a Degraded MCP names the node and the reason; oc logs -n openshift-machine-config-operator on that node's daemon shows the drain or file conflict.

Try it: Intermediate

Why does a pause on a MachineConfigPool need care during upgrades?

Now do it: Run mcp_rollout.py in Go deeper with your worker count and find the maxUnavailable that fits your window.

Advanced — Minor upgrades, OLM, and recovery

At the advanced level you handle minor upgrades and failures.

  • API removals: APIRequestCount shows which users and service accounts call deprecated APIs; migrate them, then acknowledge in admin-acks.
  • EUS to EUS: pause the worker pool, upgrade the control plane through the odd release, then unpause, so workers reboot once.
  • OLM: manual InstallPlan approval for operators that matter, catalog mirroring for disconnected clusters, and operator compatibility with the target release.
  • Recovery: etcd restore from cluster-backup.sh output as documented for your version; replacing a failed control-plane node; oc adm must-gather for support.

Try it: Advanced

A cluster is moving from one EUS release to the next. How do you avoid rebooting every worker twice?

Now do it: Read the update path for your next upgrade with oc adm upgrade and write down each hop.

Master — A fleet of clusters

At the master level you run many clusters.

  • Fleet management: Red Hat Advanced Cluster Management or GitOps for policies, upgrades, and configuration across clusters.
  • Upgrade waves: dev, then staging, then production canaries, then the rest, each gated on the previous wave's health.
  • Disconnected clusters: mirrored release images and operator catalogs (oc-mirror), and an update service of your own.
  • Capacity: enough headroom on every pool to drain maxUnavailable nodes; separate pools for nodes with special hardware.
  • Lifecycle: stay within supported versions; plan EUS hops a year ahead.

Trade-off: automatic upgrades keep clusters current and can surprise teams; manual waves are predictable and fall behind when people are busy. Automate the waves and the gates, not the decision to start.

Try it: Master

You run 40 clusters. How do you roll out a z-stream upgrade with least risk?

Now do it: Draft the waves for your clusters, with the health check that gates each one.

Go deeper

Two numbers decide most worker-pool upgrades: how many batches the pool needs, and whether any PodDisruptionBudget blocks a drain. This script computes both. Standard library only; python3 mcp_rollout.py.

Pool duration, capacity, and blocking PDBs

# mcp_rollout.py - how long a MachineConfigPool update takes, and what capacity is left meanwhile
import math

drain, reboot, ready = 6, 5, 3            # minutes per node: drain pods, reboot into the new config, become Ready
per_node = drain + reboot + ready

for workers, max_unavailable in [(12, 1), (12, 2), (12, 3), (60, 1), (60, 6)]:
    batches = math.ceil(workers / max_unavailable)
    hours = batches * per_node / 60
    left = (workers - max_unavailable) / workers
    print(f"{workers:>3} workers, maxUnavailable {max_unavailable}: {batches:>2} batches x {per_node} min = {hours:4.1f} h,"
          f" {left:.0%} of worker capacity online during the update")

# A drain only finishes if every PodDisruptionBudget allows the eviction.
pdbs = [("checkout", 3, 2), ("search", 2, 2), ("reports", 1, 0)]   # (name, ready replicas, minAvailable)
for name, ready_pods, min_available in pdbs:
    allowed = ready_pods - min_available
    print(f"PDB {name}: {ready_pods} ready, minAvailable {min_available} -> {allowed} disruption(s) allowed"
          f"{'  <- blocks every drain of a node running it' if allowed <= 0 else ''}")
$ python3 mcp_rollout.py
 12 workers, maxUnavailable 1: 12 batches x 14 min =  2.8 h, 92% of worker capacity online during the update
 12 workers, maxUnavailable 2:  6 batches x 14 min =  1.4 h, 83% of worker capacity online during the update
 12 workers, maxUnavailable 3:  4 batches x 14 min =  0.9 h, 75% of worker capacity online during the update
 60 workers, maxUnavailable 1: 60 batches x 14 min = 14.0 h, 98% of worker capacity online during the update
 60 workers, maxUnavailable 6: 10 batches x 14 min =  2.3 h, 90% of worker capacity online during the update
PDB checkout: 3 ready, minAvailable 2 -> 1 disruption(s) allowed
PDB search: 2 ready, minAvailable 2 -> 0 disruption(s) allowed  <- blocks every drain of a node running it
PDB reports: 1 ready, minAvailable 0 -> 1 disruption(s) allowed

Read it like this: sixty workers one at a time take fourteen hours; six at a time take a little over two, with 90 percent of capacity online. And a PDB with minAvailable equal to its ready replicas allows no disruptions at all, so it stops the drain of every node running one of its pods.

A MachineConfig and a worker pool setting

apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  name: 99-worker-sysctl-somaxconn
  labels:
    machineconfiguration.openshift.io/role: worker
spec:
  config:
    ignition:
      version: 3.4.0
    storage:
      files:
        - path: /etc/sysctl.d/99-somaxconn.conf
          mode: 420
          overwrite: true
          contents:
            source: data:,net.core.somaxconn%3D4096%0A
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: search
  namespace: shop
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: search

Both manifests parse as YAML and follow the MachineConfig (Ignition 3.4) and policy/v1 formats. Applying the MachineConfig drains and reboots every worker in the pool, so apply it in a maintenance window or a custom pool first. The PDB with maxUnavailable: 1 always allows one eviction, unlike minAvailable equal to the replica count.

Watch an upgrade

oc adm upgrade                                   # channel, current version, recommended targets
oc adm upgrade --to=4.16.24
oc get clusterversion
oc get co                                        # every cluster operator: Available, Progressing, Degraded
oc get mcp                                       # pools: UPDATED, UPDATING, DEGRADED
oc get pdb -A | awk '$5 == 0'                    # PDBs allowing no disruptions right now
# deprecated APIs still in use, and the release that removes them
oc get apirequestcounts -o jsonpath='{range .items[?(@.status.removedInRelease!="")]}{.status.removedInRelease}{"\t"}{.metadata.name}{"\n"}{end}'

One time it broke

This is a composite of a failure pattern that keeps repeating; the numbers are illustrative. A platform team scheduled a z-stream upgrade for a Saturday morning window.

Timeline

  • 06:00The upgrade starts. Cluster operators and the control plane finish by 07:10.
  • 07:40The worker pool stops with one node cordoned. Three teams' PDBs had minAvailable equal to their replica count; drains retry quietly.
  • 11:30The window closes with half the workers on the old OS and capacity reduced. The teams are reached on Monday.

What changed after

A policy now rejects PDBs whose minAvailable equals the selected replicas, and the pre-upgrade checklist lists every PDB with zero allowed disruptions. The worker pool was split into two pools so half the capacity is never touched in the same window.

If you remember nothing else

Design exercise

Plan the next minor upgrade for three OpenShift clusters (dev, staging, production) with 60 production workers, GPU nodes, and twelve OLM operators, inside four-hour weekend windows.

Clarifying questions to ask

Which APIs does the target release remove, and who still calls them? Which OLM operators support the target? How much spare capacity do the pools have? Which PDBs allow zero disruptions? Is this an EUS-to-EUS path?

Rough sizing

Say 14 minutes per worker, GPU nodes taking 25 minutes each because of driver reinstalls, and 30 percent spare capacity in the worker pool.

Shape of the answer

Two weeks before: APIRequestCount report and migrations, OLM compatibility check, PDB audit, and a staging dry run with timings. Production: etcd backup, upgrade the control plane, worker pool with maxUnavailable 6 (10 batches, about 2.3 hours), a separate GPU pool updated in the next window, OLM InstallPlans approved one by one, verification gates, and a rollback plan that is a restore of backups rather than a downgrade.

Trade-offs to name

A higher maxUnavailable fits the window and removes more capacity at once. Separate pools spread risk across windows and keep clusters on mixed configurations for longer. Manual InstallPlan approval prevents surprise operator upgrades and needs someone to approve them on time.

Saved on this device, in this browser.
Next in this series · Lesson 104
Service Mesh

One service calling another sounds simple. Then you have forty services, and every call needs encryption, identity, retries, and a rule about who may call whom. That work used to live in every app, written forty different ways.

Go to Lesson 104 →

Or browse the full course from the Lessons index.