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
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.
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
Fits a maintenance window with capacity to spare
Three questions. No score is saved anywhere — this is just you against the material.
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.
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.
At the intermediate level you run z-stream upgrades and node changes safely.
cluster-backup.sh on a control-plane node), PDBs that allow at least one disruption, spare capacity for draining.oc adm upgrade, oc get co, oc get mcp; maxUnavailable per pool chosen from capacity.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.
At the advanced level you handle minor upgrades and failures.
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.
At the master level you run many clusters.
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.
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.
# 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.
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.
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}'
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.
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.
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.
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?
Say 14 minutes per worker, GPU nodes taking 25 minutes each because of driver reinstalls, and 30 percent spare capacity in the worker pool.
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.
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.