Installing and configuring the OpenShift Update Service

For clusters with internet accessibility, Red Hat provides over-the-air updates through an OpenShift Container Platform update service as a hosted service located behind public APIs. However, clusters in a restricted network have no way to access public APIs for update information.

To provide a similar upgrade experience in a restricted network, you can install and configure the OpenShift Update Service locally so that it is available within a disconnected environment.

The following sections describe how to provide over-the-air updates for your disconnected cluster and its underlying operating system.

About the OpenShift Update Service

The OpenShift Update Service (OSUS) provides over-the-air updates to OKD, including Fedora CoreOS (FCOS). It provides a graph, or diagram, that contains the vertices of component Operators and the edges that connect them. The edges in the graph show which versions you can safely update to. The vertices are update payloads that specify the intended state of the managed cluster components.

The Cluster Version Operator (CVO) in your cluster checks with the OpenShift Update Service to see the valid updates and update paths based on current component versions and information in the graph. When you request an update, the CVO uses the release image for that update to upgrade your cluster. The release artifacts are hosted in Quay as container images.

To allow the OpenShift Update Service to provide only compatible updates, a release verification pipeline drives automation. Each release artifact is verified for compatibility with supported cloud platforms and system architectures, as well as other component packages. After the pipeline confirms the suitability of a release, the OpenShift Update Service notifies you that it is available.

The OpenShift Update Service displays all recommended updates for your current cluster. If an upgrade path is not recommended by the OpenShift Update Service, it might be because of a known issue with the update or the target release.

Two controllers run during continuous update mode. The first controller continuously updates the payload manifests, applies the manifests to the cluster, and outputs the controlled rollout status of the Operators to indicate whether they are available, upgrading, or failed. The second controller polls the OpenShift Update Service to determine if updates are available.

Only upgrading to a newer version is supported. Reverting or rolling back your cluster to a previous version is not supported. If your upgrade fails, contact Red Hat support.

During the upgrade process, the Machine Config Operator (MCO) applies the new configuration to your cluster machines. The MCO cordons the number of nodes as specified by the maxUnavailable field on the machine configuration pool and marks them as unavailable. By default, this value is set to 1. The MCO then applies the new configuration and reboots the machine.

If you use Fedora machines as workers, the MCO does not update the kubelet because you must update the OpenShift API on the machines first.

With the specification for the new version applied to the old kubelet, the Fedora machine cannot return to the Ready state. You cannot complete the update until the machines are available. However, the maximum number of unavailable nodes is set to ensure that normal cluster operations can continue with that number of machines out of service.

The OpenShift Update Service is composed of an Operator and one or more application instances.

Prerequisites

Configuring access to a secured registry for the OpenShift update service

If the release images are contained in a secure registry, complete the steps in Configuring additional trust stores for image registry access along with following changes for the update service.

The OpenShift Update Service Operator needs the config map key name updateservice-registry in the registry CA cert.

Image registry CA config map example for the update service

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: my-registry-ca
  5. data:
  6. updateservice-registry: | (1)
  7. -----BEGIN CERTIFICATE-----
  8. ...
  9. -----END CERTIFICATE-----
  10. registry-with-port.example.com..5000: | (2)
  11. -----BEGIN CERTIFICATE-----
  12. ...
  13. -----END CERTIFICATE-----
1The OpenShift Update Service Operator requires the config map key name updateservice-registry in the registry CA cert.
2If the registry has the port, such as registry-with-port.example.com:5000, : should be replaced with ...

Installing the OpenShift Update Service Operator

To install the OpenShift Update Service, you must first install the OpenShift Update Service Operator by using the OKD web console or CLI.

For clusters that are installed on restricted networks, also known as disconnected clusters, Operator Lifecycle Manager by default cannot access the Red Hat-provided OperatorHub sources hosted on remote registries because those remote sources require full internet connectivity. For more information, see Using Operator Lifecycle Manager on restricted networks.

Installing the OpenShift Update Service Operator by using the web console

You can use the web console to install the OpenShift Update Service Operator.

Procedure

  1. In the web console, click OperatorsOperatorHub.

    Enter Update Service into the Filter by keyword…​ field to find the Operator faster.

  2. Choose OpenShift Update Service from the list of available Operators, and click Install.

    1. Channel v1 is selected as the Update Channel since it is the only channel available in this release.

    2. Select A specific namespace on the cluster under Installation Mode.

    3. Select a namespace for Installed Namespace or accept the recommended namespace openshift-update-service.

    4. Select an Approval Strategy:

      • The Automatic strategy allows Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available.

      • The Manual strategy requires a cluster administrator to approve the Operator update.

    5. Click Install.

  3. Verify that the OpenShift Update Service Operator is installed by switching to the OperatorsInstalled Operators page.

  4. Ensure that OpenShift Update Service is listed in the selected namespace with a Status of Succeeded.

Installing the OpenShift Update Service Operator by using the CLI

You can use the OpenShift CLI (oc) to install the OpenShift Update Service Operator.

Procedure

  1. Create a namespace for the OpenShift Update Service Operator:

    1. Create a Namespace object YAML file, for example, update-service-namespace.yaml, for the OpenShift Update Service Operator:

      1. apiVersion: v1
      2. kind: Namespace
      3. metadata:
      4. name: openshift-update-service
      5. annotations:
      6. openshift.io/node-selector: ""
      7. labels:
      8. openshift.io/cluster-monitoring: "true" (1)
      1Set the openshift.io/cluster-monitoring label to enable Operator-recommended cluster monitoring on this namespace.
    2. Create the namespace:

      1. $ oc create -f <filename>.yaml

      For example:

      1. $ oc create -f update-service-namespace.yaml
  2. Install the OpenShift Update Service Operator by creating the following objects:

    1. Create an OperatorGroup object YAML file, for example, update-service-operator-group.yaml:

      1. apiVersion: operators.coreos.com/v1
      2. kind: OperatorGroup
      3. metadata:
      4. name: update-service-operator-group
      5. spec:
      6. targetNamespaces:
      7. - openshift-update-service
    2. Create an OperatorGroup object:

      1. $ oc -n openshift-update-service create -f <filename>.yaml

      For example:

      1. $ oc -n openshift-update-service create -f update-service-operator-group.yaml
    3. Create a Subscription object YAML file, for example, update-service-subscription.yaml:

      Example Subscription

      1. apiVersion: operators.coreos.com/v1alpha1
      2. kind: Subscription
      3. metadata:
      4. name: update-service-subscription
      5. spec:
      6. channel: v1
      7. installPlanApproval: "Automatic"
      8. source: "redhat-operators" (1)
      9. sourceNamespace: "openshift-marketplace"
      10. name: "cincinnati-operator"
      1Specify the name of the catalog source that provides the Operator. For clusters that do not use a custom Operator Lifecycle Manager (OLM), specify redhat-operators. If your OKD cluster is installed on a restricted network, also known as a disconnected cluster, specify the name of the CatalogSource object created when you configured Operator Lifecycle Manager (OLM).
    4. Create the Subscription object:

      1. $ oc create -f <filename>.yaml

      For example:

      1. $ oc -n openshift-update-service create -f update-service-subscription.yaml

      The OpenShift Update Service Operator is installed to the openshift-update-service namespace and targets the openshift-update-service namespace.

  3. Verify the Operator installation:

    1. $ oc -n openshift-update-service get clusterserviceversions

    Example output

    1. NAME DISPLAY VERSION REPLACES PHASE
    2. update-service-operator.v4.6.0 OpenShift Update Service 4.6.0 Succeeded
    3. ...

    If the OpenShift Update Service Operator is listed, the installation was successful. The version number might be different than shown.

Creating the OpenShift Update Service graph data container image

The OpenShift Update Service requires a graph-data container image, from which the OpenShift Update Service retrieves information about channel membership and blocked update edges. Graph data is typically fetched directly from the upgrade graph data repository. In environments where an internet connection is unavailable, loading this information from an init container is another way to make the graph data available to the OpenShift Update Service. The role of the init container is to provide a local copy of the graph data, and during pod initialization, the init container copies the data to a volume that is accessible by the service.

Procedure

  1. Create a Dockerfile, for example, ./Dockerfile, containing the following:

    1. FROM registry.access.redhat.com/ubi8/ubi:8.1
    2. RUN curl -L -o cincinnati-graph-data.tar.gz https://github.com/openshift/cincinnati-graph-data/archive/master.tar.gz
    3. CMD exec /bin/bash -c "tar xvzf cincinnati-graph-data.tar.gz -C /var/lib/cincinnati/graph-data/ --strip-components=1"
  2. Use the docker file created in the above step to build a graph-data container image, for example, registry.example.com/openshift/graph-data:latest:

    1. $ podman build -f ./Dockerfile -t registry.example.com/openshift/graph-data:latest
  3. Push the graph-data container image created in the above step to a repository that is accessible to the OpenShift Update Service, for example, registry.example.com/openshift/graph-data:latest:

    1. $ podman push registry.example.com/openshift/graph-data:latest

Mirroring the OKD image repository

The OpenShift Update Service requires a locally accessible registry containing update release payloads.

To avoid excessive memory usage by the OpenShift Update Service application, it is recommended that you mirror release images to a separate repository, as described in the following procedure.

Prerequisites

  • You reviewed and completed the steps from “Mirroring images for a disconnected installation” up to but not including the section entitled Mirroring the OKD image repository.

  • You configured a mirror registry to use in your restricted network and can access the certificate and credentials that you configured.

  • You have created a pull secret for your mirror repository.

  • If you use self-signed certificates that do not set a Subject Alternative Name, you must precede the oc commands in this procedure with GODEBUG=x509ignoreCN=0. If you do not set this variable, the oc commands will fail with the following error:

    1. x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0

Procedure

Complete the following steps on the mirror host:

  1. Review the OKD downloads page to determine the version of OKD to which you want to upgrade and determine the corresponding tag on the Repository Tags page.

  2. Set the required environment variables:

    1. Export the release version:

      1. $ OCP_RELEASE=<release_version>

      For <release_version>, specify the tag that corresponds to the version of OKD to install, such as 4.6.4.

    2. Export the local registry name and host port:

      1. $ LOCAL_REGISTRY='<local_registry_host_name>:<local_registry_host_port>'

      For <local_registry_host_name>, specify the registry domain name for your mirror repository, and for <local_registry_host_port>, specify the port that it serves content on.

    3. Export the local repository name:

      1. $ LOCAL_REPOSITORY='<local_repository_name>'

      For <local_repository_name>, specify the name of the repository to create in your registry, such as ocp4/openshift4.

    4. Export an additional local repository name to contain the release images:

      1. $ LOCAL_RELEASE_IMAGES_REPOSITORY='<local_release_images_repository_name>'

      For <local_release_images_repository_name>, specify the name of the repository to create in your registry, such as ocp4/openshift4-release-images.

    5. Export the name of the repository to mirror:

      1. $ PRODUCT_REPO='openshift-release-dev'

      For a production release, you must specify openshift-release-dev.

    6. Export the path to your registry pull secret:

      1. $ LOCAL_SECRET_JSON='<path_to_pull_secret>'

      For <path_to_pull_secret>, specify the absolute path to and file name of the pull secret for your mirror registry that you created.

    7. Export the release mirror:

      1. $ RELEASE_NAME="ocp-release"

      For a production release, you must specify ocp-release.

    8. Export the type of architecture for your server, such as x86_64:

      1. $ ARCHITECTURE=<server_architecture>
    9. Export the path to the directory to host the mirrored images:

      1. $ REMOVABLE_MEDIA_PATH=<path> (1)
      1Specify the full path, including the initial forward slash (/) character.
  3. Mirror the version images to the internal container registry:

    • If your mirror host does not have internet access, take the following actions:

      1. Connect the removable media to a system that is connected to the Internet.

      2. Review the images and configuration manifests to mirror:

        1. $ oc adm release mirror -a ${LOCAL_SECRET_JSON} \
        2. --from=quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE} \
        3. --to=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} \
        4. --to-release-image=${LOCAL_REGISTRY}/${LOCAL_RELEASE_IMAGES_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE} --dry-run
      3. Mirror the images to a directory on the removable media:

        1. $ oc adm release mirror -a ${LOCAL_SECRET_JSON} --to-dir=${REMOVABLE_MEDIA_PATH}/mirror quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE}
      4. Take the media to the restricted network environment and upload the images to the local container registry:

        1. $ oc image mirror -a ${LOCAL_SECRET_JSON} --from-dir=${REMOVABLE_MEDIA_PATH}/mirror "file://openshift/release:${OCP_RELEASE}*" ${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} (1)
        1For REMOVABLE_MEDIA_PATH, you must use the path where you mounted the removable media.
      5. Mirror the release image to a separate repository:

        1. $ oc image mirror -a ${LOCAL_SECRET_JSON} ${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE} ${LOCAL_REGISTRY}/${LOCAL_RELEASE_IMAGES_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE}
    • If the local container registry is connected to the mirror host, push the release images directly to the local registry:

      1. $ oc adm release mirror -a ${LOCAL_SECRET_JSON} \
      2. --from=quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE} \
      3. --to=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} \
      4. --to-release-image=${LOCAL_REGISTRY}/${LOCAL_RELEASE_IMAGES_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE}

Creating an OpenShift Update Service application

You can create an OpenShift Update Service application by using the OKD web console or CLI.

Creating an OpenShift Update Service application by using the web console

You can use the OKD web console to create an OpenShift Update Service application by using the OpenShift Update Service Operator.

Prerequisites

  • The OpenShift Update Service Operator has been installed.

  • The OpenShift Update Service graph-data container image has been created and pushed to a repository that is accessible to the OpenShift Update Service.

  • The current release and update target releases have been mirrored to a locally accessible registry.

Procedure

  1. In the web console, click OperatorsInstalled Operators.

  2. Choose OpenShift Update Service from the list of installed Operators.

  3. Click the Update Service tab.

  4. Click Create UpdateService.

  5. Enter a name in the Name field, for example, service.

  6. Enter the local pullspec in the Graph Data Image field to the graph-data container image created in “Creating the OpenShift Update Service graph data container image”, for example, registry.example.com/openshift/graph-data:latest.

  7. In the Releases field, enter the local registry and repository created to contain the release images in “Mirroring the OpenShift Container Platform image repository”, for example, registry.example.com/ocp4/openshift4-release-images.

  8. Enter 2 in the Replicas field.

  9. Click Create to create the OpenShift Update Service application.

  10. Verify the OpenShift Update Service application:

    • From the UpdateServices list in the Update Service tab, click the Update Service application just created.

    • Click the Resources tab.

    • Verify each application resource has a status of Created.

Creating an OpenShift Update Service application by using the CLI

You can use the OpenShift CLI (oc) to create an OpenShift Update Service application.

Prerequisites

  • The OpenShift Update Service Operator has been installed.

  • The OpenShift Update Service graph-data container image has been created and pushed to a repository that is accessible to the OpenShift Update Service.

  • The current release and update target releases have been mirrored to a locally accessible registry.

Procedure

  1. Configure the OpenShift Update Service target namespace, for example, openshift-update-service:

    1. $ NAMESPACE=openshift-update-service

    The namespace must match the targetNamespaces value from the operator group.

  2. Configure the name of the OpenShift Update Service application, for example, service:

    1. $ NAME=service
  3. Configure the local registry and repository for the release images as configured in “Mirroring the OKD image repository”, for example, registry.example.com/ocp4/openshift4-release-images:

    1. $ RELEASE_IMAGES=registry.example.com/ocp4/openshift4-release-images
  4. Set the local pullspec for the graph-data image to the graph-data container image created in “Creating the OpenShift Update Service graph data container image”, for example, registry.example.com/openshift/graph-data:latest:

    1. $ GRAPH_DATA_IMAGE=registry.example.com/openshift/graph-data:latest
  5. Create an OpenShift Update Service application object:

    1. $ oc -n "${NAMESPACE}" create -f - <<EOF
    2. apiVersion: updateservice.operator.openshift.io/v1
    3. kind: UpdateService
    4. metadata:
    5. name: ${NAME}
    6. spec:
    7. replicas: 2
    8. releases: ${RELEASE_IMAGES}
    9. graphDataImage: ${GRAPH_DATA_IMAGE}
    10. EOF
  6. Verify the OpenShift Update Service application:

    1. Use the following command to obtain a policy engine route:

      1. $ while sleep 1; do POLICY_ENGINE_GRAPH_URI="$(oc -n "${NAMESPACE}" get -o jsonpath='{.status.policyEngineURI}/api/upgrades_info/v1/graph{"\n"}' updateservice "${NAME}")"; SCHEME="${POLICY_ENGINE_GRAPH_URI%%:*}"; if test "${SCHEME}" = http -o "${SCHEME}" = https; then break; fi; done

      You might need to poll until the command succeeds.

    2. Retrieve a graph from the policy engine. Be sure to specify a valid version for channel. For example, if running in OKD 4.6, use stable-4.6:

      1. $ while sleep 10; do HTTP_CODE="$(curl --header Accept:application/json --output /dev/stderr --write-out "%{http_code}" "${POLICY_ENGINE_GRAPH_URI}?channel=stable-4.6")"; if test "${HTTP_CODE}" -eq 200; then break; fi; echo "${HTTP_CODE}"; done

      This polls until the graph request succeeds; however, the resulting graph might be empty depending on which release images you have mirrored.

The policy engine route name must not be more than 63 characters based on RFC-1123. If you see ReconcileCompleted status as false with the reason CreateRouteFailed caused by host must conform to DNS 1123 naming convention and must be no more than 63 characters, try creating the Update Service with a shorter name.

Configuring the Cluster Version Operator (CVO)

After the OpenShift Update Service Operator has been installed and the OpenShift Update Service application has been created, the Cluster Version Operator (CVO) can be updated to pull graph data from the locally installed OpenShift Update Service.

Prerequisites

  • The OpenShift Update Service Operator has been installed.

  • The OpenShift Update Service graph-data container image has been created and pushed to a repository that is accessible to the OpenShift Update Service.

  • The current release and update target releases have been mirrored to a locally accessible registry.

  • The OpenShift Update Service application has been created.

Procedure

  1. Set the OpenShift Update Service target namespace, for example, openshift-update-service:

    1. $ NAMESPACE=openshift-update-service
  2. Set the name of the OpenShift Update Service application, for example, service:

    1. $ NAME=service
  3. Obtain the policy engine route:

    1. $ POLICY_ENGINE_GRAPH_URI="$(oc -n "${NAMESPACE}" get -o jsonpath='{.status.policyEngineURI}/api/upgrades_info/v1/graph{"\n"}' updateservice "${NAME}")"
  4. Set the patch for the pull graph data:

    1. $ PATCH="{\"spec\":{\"upstream\":\"${POLICY_ENGINE_GRAPH_URI}\"}}"
  5. Patch the CVO to use the local OpenShift Update Service:

    1. $ oc patch clusterversion version -p $PATCH --type merge

Deleting an OpenShift Update Service application

You can delete an OpenShift Update Service application by using the OKD web console or CLI.

Deleting an OpenShift Update Service application by using the web console

You can use the OKD web console to delete an OpenShift Update Service application by using the OpenShift Update Service Operator.

Prerequisites

  • The OpenShift Update Service Operator has been installed.

Procedure

  1. In the web console, click OperatorsInstalled Operators.

  2. Choose OpenShift Update Service from the list of installed Operators.

  3. Click the Update Service tab.

  4. From the list of installed OpenShift Update Service applications, select the application to be deleted and then click Delete UpdateService.

  5. From the Delete UpdateService? confirmation dialog, click Delete to confirm the deletion.

Deleting an OpenShift Update Service application by using the CLI

You can use the OpenShift CLI (oc) to delete an OpenShift Update Service application.

Procedure

  1. Get the OpenShift Update Service application name using the namespace the OpenShift Update Service application was created in, for example, openshift-update-service:

    1. $ oc get updateservice -n openshift-update-service

    Example output

    1. NAME AGE
    2. service 6s
  2. Delete the OpenShift Update Service application using the NAME value from the previous step and the namespace the OpenShift Update Service application was created in, for example, openshift-update-service:

    1. $ oc delete updateservice service -n openshift-update-service

    Example output

    1. updateservice.updateservice.operator.openshift.io "service" deleted

Uninstalling the OpenShift Update Service Operator

To uninstall the OpenShift Update Service, you must first delete all OpenShift Update Service applications by using the OKD web console or CLI.

Uninstalling the OpenShift Update Service Operator by using the web console

You can use the OKD web console to uninstall the OpenShift Update Service Operator.

Prerequisites

  • All OpenShift Update Service applications have been deleted.

Procedure

  1. In the web console, click OperatorsInstalled Operators.

  2. Select OpenShift Update Service from the list of installed Operators and click Uninstall Operator.

  3. From the Uninstall Operator? confirmation dialog, click Uninstall to confirm the uninstallation.

Uninstalling the OpenShift Update Service Operator by using the CLI

You can use the OpenShift CLI (oc) to uninstall the OpenShift Update Service Operator.

Prerequisites

  • All OpenShift Update Service applications have been deleted.

Procedure

  1. Change to the project containing the OpenShift Update Service Operator, for example, openshift-update-service:

    1. $ oc project openshift-update-service

    Example output

    1. Now using project "openshift-update-service" on server "https://example.com:6443".
  2. Get the name of the OpenShift Update Service Operator operator group:

    1. $ oc get operatorgroup

    Example output

    1. NAME AGE
    2. openshift-update-service-fprx2 4m41s
  3. Delete the operator group, for example, openshift-update-service-fprx2:

    1. $ oc delete operatorgroup openshift-update-service-fprx2

    Example output

    1. operatorgroup.operators.coreos.com "openshift-update-service-fprx2" deleted
  4. Get the name of the OpenShift Update Service Operator subscription:

    1. $ oc get subscription

    Example output

    1. NAME PACKAGE SOURCE CHANNEL
    2. update-service-operator update-service-operator updateservice-index-catalog v1
  5. Using the Name value from the previous step, check the current version of the subscribed OpenShift Update Service Operator in the currentCSV field:

    1. $ oc get subscription update-service-operator -o yaml | grep " currentCSV"

    Example output

    1. currentCSV: update-service-operator.v0.0.1
  6. Delete the subscription, for example, update-service-operator:

    1. $ oc delete subscription update-service-operator

    Example output

    1. subscription.operators.coreos.com "update-service-operator" deleted
  7. Delete the CSV for the OpenShift Update Service Operator using the currentCSV value from the previous step:

    1. $ oc delete clusterserviceversion update-service-operator.v0.0.1

    Example output

    1. clusterserviceversion.operators.coreos.com "update-service-operator.v0.0.1" deleted