16.3. Performing an image-based upgrade for single-node OpenShift clusters with the Lifecycle Agent
You can use the Lifecycle Agent to do a manual image-based upgrade of a single-node OpenShift cluster.
When you deploy the Lifecycle Agent on a cluster, an ImageBasedUpgrade CR is automatically created. You update this CR to specify the image repository of the seed image and to move through the different stages.
When you deploy the Lifecycle Agent on a cluster, the Lifecycle Agent automatically creates an ImageBasedUpgrade custom resource (CR).
After you create all the resources that you need during the upgrade, you can move on to the Prep stage. For more information, see the "Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent" section.
In a disconnected environment, if the seed cluster’s release image registry is different from the target cluster’s release image registry, you must create an ImageDigestMirrorSet (IDMS) resource to configure alternative mirrored repository locations. For more information, see "Configuring image registry repository mirroring".
You can retrieve the release registry used in the seed image by running the following command:
$ skopeo inspect docker://<imagename> | jq -r '.Labels."com.openshift.lifecycle-agent.seed_cluster_info" | fromjson | .release_registry'
Prerequisites
- You have created resources to back up and restore your clusters.
Procedure
Check that you have patched your
ImageBasedUpgradeCR:apiVersion: lca.openshift.io/v1 kind: ImageBasedUpgrade metadata: name: upgrade spec: stage: Idle seedImageRef: version: <target_version> image: <seed_container_image> pullSecretRef: <seed_pull_secret> autoRollbackOnFailure: {} initMonitorTimeoutSeconds: <initMonitorTimeoutSeconds> extraManifests: - name: example-extra-manifests-cm namespace: openshift-lifecycle-agent - name: example-catalogsources-cm namespace: openshift-lifecycle-agent oadpContent: - name: oadp-cm-example namespace: openshift-adpwhere:
<target_version>- Target platform version. The value must match the version of the seed image.
<seed_container_image>- Repository where the target cluster can pull the seed image from.
<seed_pull_secret>- Reference to a secret with credentials to pull container images if the images are in a private registry.
<initMonitorTimeoutSeconds>-
Optional: Time frame in seconds to roll back if the upgrade does not complete within that time frame after the first reboot. If not defined or set to
0, the Lifecycle Agent uses the default value of1800seconds (30 minutes). extraManifests-
Optional: List of
ConfigMapresources. These resources contain your custom catalog sources to retain after the upgrade and any extra manifests that the seed image does not include. oadpContent-
List of
ConfigMapresources that contain the OADPBackupandRestoreCRs.
To start the
Prepstage, change the value of thestagefield toPrepin theImageBasedUpgradeCR by running the following command:$ oc patch imagebasedupgrades.lca.openshift.io upgrade -p='{"spec": {"stage": "Prep"}}' --type=merge -n openshift-lifecycle-agentIf you include
ConfigMapobjects for OADP resources and extra manifests, Lifecycle Agent validates the specifiedConfigMapobjects during thePrepstage.The following issues might occur:
-
Validation warnings or errors if the Lifecycle Agent detects any issues with the
extraManifestsparameters. -
Validation errors if the Lifecycle Agent detects any issues with the
oadpContentparameters.
Validation warnings do not block the
Upgradestage but you must decide if it is safe to proceed with the upgrade. These warnings, for example missing custom resource definitions (CRDs), namespaces, or dry run failures, update thestatus.conditionsfor thePrepstage andannotationfields in theImageBasedUpgradeCR with details about the warning. The following example shows these details:# ... metadata: annotations: extra-manifest.lca.openshift.io/validation-warning: '...' # ...However, validation errors, such as adding
MachineConfigor Operator manifests to extra manifests, cause thePrepstage to fail and block theUpgradestage.When the validations pass, the cluster creates a new
ostreestateroot, which involves pulling and unpacking the seed image, and running host-level commands. Finally, the Lifecycle Agent precaches all the required images on the target cluster.-
Validation warnings or errors if the Lifecycle Agent detects any issues with the
Verification
Check the status of the
ImageBasedUpgradeCR by running the following command:$ oc get ibu -o yamlThe following example shows a successful
Prepstage:conditions: - lastTransitionTime: "2024-01-01T09:00:00Z" message: In progress observedGeneration: 13 reason: InProgress status: "False" type: Idle - lastTransitionTime: "2024-01-01T09:00:00Z" message: Prep completed observedGeneration: 13 reason: Completed status: "False" type: PrepInProgress - lastTransitionTime: "2024-01-01T09:00:00Z" message: Prep stage completed successfully observedGeneration: 13 reason: Completed status: "True" type: PrepCompleted observedGeneration: 13 validNextStages: - Idle - Upgrade