"oc adm upgrade status" command is not working as expected in OpenShift

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4
  • oc CLI

Issue

  • Command oc adm upgrade status is not working as expected.
  • Command oc adm upgrade and command oc adm upgrade status showing same results.

Resolution

The oc adm upgrade status command was introduced in OpenShift 4.16 oc binary as a Technology Preview feature, and it is fully supported starting with OpenShift 4.20 (along with the oc adm upgrade recommend command) as explained in the OpenShift CLI (oc) release notes.

Using oc adm upgrade status command in older versions

For being able to use the command in oc versions older than 4.20, it requires exporting an environment variable:

$ export OC_ENABLE_CMD_UPGRADE_STATUS=true

If the oc binary version used is older than 4.16, it will be needed to install a newer OpenShift CLI binary:

$ oc version
Client Version: 4.15.7

Note: check the oc binary compatibility matrix for version compatibility, as not all features can be used if the version of the oc binary and the version of the cluster are different.

Root Cause

Command oc adm upgrade status decouples status information from the oc adm upgrade command. It provides specific information regarding a cluster update, including the status of the control plane and worker node updates. An older version of the oc CLI causes the oc adm upgrade status command to function differently, showing the same output as the oc adm upgrade command.

Diagnostic Steps

  • Check the oc version:

    $ oc version
    Client Version: 4.9.23
    Server Version: 4.16.1
    Kubernetes Version: v1.29.5+58452d8
    
  • View the available updates:

    $ oc adm upgrade
    Cluster version is 4.16.1Upstream is unset, so the cluster will use an appropriate default.
    Channel: stable-4.16 (available channels: candidate-4.16, candidate-4.17, eus-4.16, fast-4.16, stable-4.16)
    No updates available. You may force an upgrade to a specific release image, but doing so may not be supported and may result in downtime or data loss.
    
  • Export environment variable:

    $ export OC_ENABLE_CMD_UPGRADE_STATUS=true
    
  • Check upgrade status with the environment:

        $ oc adm upgrade status
        = Control Plane =
        Assessment:      Completed
        Target Version:  4.16.54 (a new install)
        Completion:      100%
        Duration:        2h8m
        Operator Status: 32 Healthy, 1 Unavailable
    
        Control Plane Nodes
        NAME       ASSESSMENT   PHASE     VERSION   EST   MESSAGE
        master-0   Completed    Updated   4.16.54   -     
        master-1   Completed    Updated   4.16.54   -     
        master-2   Completed    Updated   4.16.54   -     
    
        = Worker Upgrade =
    
        = Worker Pool =
        Worker Pool:     worker
        Assessment:      Completed
        Completion:      100%
        Worker Status:   2 Total, 2 Available, 0 Progressing, 0 Outdated, 0 Draining, 0 Excluded, 0 Degraded
    
        Worker Pool Nodes
        NAME       ASSESSMENT   PHASE     VERSION   EST   MESSAGE
        worker-0   Completed    Updated   4.16.54   -     
        worker-0   Completed    Updated   4.16.54   -     
    
        = Update Health =
        SINCE     LEVEL     IMPACT           MESSAGE
        1h6m8s   Warning   Update Stalled   Cluster Version version is failing to proceed with the update (ClusterOperatorNotAvailable)
    
        Run with --details=health for additional description and links to related online documentation
    
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.