DEV Community

Cover image for How to upgrade Openshift 4.x
mkdev.me for mkdev

Posted on • Edited on • Originally published at mkdev.me

How to upgrade Openshift 4.x

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Then connect to the node terminal:

oc debug --as-root node
Enter fullscreen mode Exit fullscreen mode

Next, execute the command to backup your etc database:

/usr/local/bin/cluster-backup.sh /home/core/assets/backup
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Then annotate it to pause:

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

Remember to reactivate it after the update:

oc -n openshift-machine-api annotate mhc cluster.x-k8s.io/paused-
Enter fullscreen mode Exit fullscreen mode

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:

This article was written by Pablo Inigo Sanchez for mkdev.me

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay