OpenShift Tips


Upgrade cluster to latest

oc adm upgrade --to-latest

Force the update to a specific version/hash

  • Get the hash of the image version

    curl -sH 'Accept: application/json' "${CHANNEL}&${ARCH}" | jq .
  • Apply the update

    oc adm upgrade --allow-explicit-upgrade --force=true

Verify the available upgrade versions

Kudos to Ramon Gordillo

Depending on the OCP version you can upgrade to some specific versions.

For 4.1.10 for amd64:

curl -s -XGET "" --header 'Accept:application/json' |jq '. as $graph | $graph.nodes | map(.version == "4.1.10") | index(true) as $orig | $graph.edges | map(select(.[0] == $orig)[1]) | map($graph.nodes[.])'

Output is something similar to:

    "version": "4.1.11",
    "payload": "",
    "metadata": {
      "description": "",
      "url": "",
      "io.openshift.upgrades.graph.release.manifestref": "sha256:bfca31dbb518b35f312cc67516fa18aa40df9925dc84fdbcd15f8bbca425d7ff",
      "io.openshift.upgrades.graph.release.channels": "stable-4.1"

Switch OpenShift Channel and trigger a refresh

For instance, switching from stable-4.6 to fast-4.6:

oc patch clusterversion version --type="merge" -p '{"spec":{"channel":"fast-4.6"}}'
oc delete po -n openshift-cluster-version -l k8s-app=cluster-version-operator

Then you can update to latest as:

oc adm upgrade --to-latest
Last updated on 21 Aug 2023
Published on 18 Jun 2019
Edit on GitHub