How to upgrade Openshift 4.x

Illustration of a stylized male character in a dynamic pose with a soccer ball, split potion cauldron, and a graphic red and yellow circular emblem. Illustration of a stylized male character in a dynamic pose with a soccer ball, split potion cauldron, and a graphic red and yellow circular emblem.

You might remember our video showing how to install OpenShift on GCP. Today, we're going to learn how to update OpenShift in GCP as well, though the process is applicable to other platforms too.

First, we need to install our cluster. I recommend revisiting our previous video for that. Ultimately, you should have an install-config.yaml with your setup ready, and then execute:

./openshift-install create cluster --dir install --log-level=debug

As you recall from our video, we used OKD, which is the open-source version of OpenShift and matches the same version as OpenShift. We are currently on version 4.13, awaiting version 4.14. The primary difference is the version, but we'll manage that.

We'll start with version 4.10, aiming to upgrade to 4.13. First, we need to prepare our cluster:

  • Perform all operations as a kubeadmin. If you're not, use RBAC to grant yourself the necessary permissions.
  • Create an etc backup using one of the master nodes:
oc get nodes

Then connect to the node terminal:

oc debug --as-root node

Next, execute the command to backup your etc database:

/usr/local/bin/cluster-backup.sh /home/core/assets/backup

After a while, the backup completes, and you can list the backup files with an ls command.

  • Since we're moving to 4.13, support for Red Hat 7 in worker nodes has been removed; Red Hat 8 is the minimum requirement.
  • All your operators need to be updated before any system updates.
  • Ensure no machine config pool is paused.
  • With the installation of Kubernetes 1.26 in 4.13, some APIs will be deprecated. To check usage of these APIs, execute:
oc get apirequestcounts

Identify workloads using these APIs and update them according to the documentation.

Lastly, before starting the update, pause the machine healthcheck resource:

oc get machinehealthcheck -n openshift-machine-api

Then annotate it to pause:

oc -n openshift-machine-api annotate mhc cluster.x-k8s.io/paused=""

Remember to reactivate it after the update:

oc -n openshift-machine-api annotate mhc cluster.x-k8s.io/paused-

Checking with oc version, we see we are at version 4.10, specifically the OKD version. In Red Hat, there is a tool called Red Hat OpenShift Container Platform Update Graph that shows the upgrade path we need to follow.

For instance, if we start with the current channel at 4.10 stable, begin with OpenShift version 4.10.3, and target the latest version 4.13.14, the steps are as follows:

From 4.10.3 to 4.10.56, then 4.11.50, 4.12.36, and finally 4.13.14.

Here’s the plan: execute the oc patch clusterversion command to set the channel, followed by oc adm upgrade for each step.

There is also a GUI option that updates each minor version step by step as shown in the video.

I hope you've understood all the steps, and see you next time!


Here' the same article in video form for your convenience: