×

Running your cluster in a restricted network without direct internet connectivity is possible by installing the cluster from a mirrored set of OKD container images in a private registry. This registry must be running at all times as long as the cluster is running. See the Prerequisites section for more information.

You can use the oc-mirror OpenShift CLI (oc) plug-in to mirror images to a mirror registry in your fully or partially disconnected environments. You must run oc-mirror from a system with internet connectivity in order to download the required images from the official Red Hat registries.

The following steps outline the high-level workflow on how to use the oc-mirror plug-in to mirror images to a mirror registry:

  1. Create an image set configuration file.

  2. Mirror the image set to the mirror registry by using one of the following methods:

    • Mirror an image set directly to the mirror registry.

    • Mirror an image set to disk, transfer the image set to the target environment, then upload the image set to the target mirror registry.

  3. Install the ImageContentSourcePolicy and CatalogSource resources that were generated by oc-mirror into the cluster.

  4. Repeat these steps to update your mirror registry as necessary.

About the oc-mirror plug-in

You can use the oc-mirror OpenShift CLI (oc) plug-in to mirror all required OKD content and other images to your mirror registry by using a single tool. It provides the following features:

  • Provides a centralized method to mirror OKD releases, Operators, helm charts, and other images.

  • Maintains update paths for OKD and Operators.

  • Uses a declarative image set configuration file to include only the OKD releases, Operators, and images that your cluster needs.

  • Performs incremental mirroring, which reduces the size of future image sets.

  • Prunes images from the target mirror registry that were excluded from the image set configuration since the previous execution.

  • Optionally generates supporting artifacts for OpenShift Update Service (OSUS) usage.

When using the oc-mirror plug-in, you specify which content to mirror in an image set configuration file. In this YAML file, you can fine-tune the configuration to only include the OKD releases and Operators that your cluster needs. This reduces the amount of data that you need to download and transfer. The oc-mirror plug-in can also mirror arbitrary helm charts and additional container images to assist users in seamlessly synchronizing their workloads onto mirror registries.

The first time you run the oc-mirror plug-in, it populates your mirror registry with the required content to perform your disconnected cluster installation. In order for your disconnected cluster to continue receiving updates, you must keep your mirror registry updated. To update your mirror registry, you run the oc-mirror plug-in using the same configuration as the first time you ran it. The oc-mirror plug-in references the metadata from the storage backend and only downloads what has been released since the last time you ran the tool. This provides update paths for OKD and Operators and performs dependency resolution as required.

When using the oc-mirror CLI plug-in to populate a mirror registry, any further updates to the mirror registry must be made using the oc-mirror tool.

About the mirror registry

You can mirror the images that are required for OKD installation and subsequent product updates to a container mirror registry that supports Docker v2-2, such as Red Hat Quay. If you do not have access to a large-scale container registry, you can use the mirror registry for Red Hat OpenShift, which is a small-scale container registry included with OKD subscriptions.

Regardless of your chosen registry, the procedure to mirror content from Red Hat hosted sites on the internet to an isolated image registry is the same. After you mirror the content, you configure each cluster to retrieve this content from your mirror registry.

The internal registry of the OKD cluster cannot be used as the target registry because it does not support pushing without a tag, which is required during the mirroring process.

If choosing a container registry that is not the mirror registry for Red Hat OpenShift, it must be reachable by every machine in the clusters that you provision. If the registry is unreachable, installation, updating, or normal operations such as workload relocation might fail. For that reason, you must run mirror registries in a highly available way, and the mirror registries must at least match the production availability of your OKD clusters.

When you populate your mirror registry with OKD images, you can follow two scenarios. If you have a host that can access both the internet and your mirror registry, but not your cluster nodes, you can directly mirror the content from that machine. This process is referred to as connected mirroring. If you have no such host, you must mirror the images to a file system and then bring that host or removable media into your restricted environment. This process is referred to as disconnected mirroring.

For mirrored registries, to view the source of pulled images, you must review the Trying to access log entry in the CRI-O logs. Other methods to view the image pull source, such as using the crictl images command on a node, show the non-mirrored image name, even though the image is pulled from the mirrored location.

Red Hat does not test third party registries with OKD.

Additional resources

Prerequisites

  • You must have a container image registry that supports Docker v2-2 in the location that will host the OKD cluster, such as Red Hat Quay.

    If you use Red Hat Quay, you must use version 3.6 or later with the oc-mirror plug-in. If you have an entitlement to Red Hat Quay, see the documentation on deploying Red Hat Quay for proof-of-concept purposes or by using the Quay Operator. If you need additional assistance selecting and installing a registry, contact your sales representative or Red Hat Support.

    If you do not already have an existing solution for a container image registry, subscribers of OKD are provided a mirror registry for Red Hat OpenShift. The mirror registry for Red Hat OpenShift is included with your subscription and is a small-scale container registry that can be used to mirror the required container images of OKD in disconnected installations.

Preparing your mirror hosts

Before you can use the oc-mirror plug-in to mirror images, you must install the plug-in and create a container image registry credentials file to allow the mirroring from Red Hat to your mirror.

Installing the oc-mirror OpenShift CLI plug-in

To use the oc-mirror OpenShift CLI plug-in to mirror registry images, you must install the plug-in. If you are mirroring image sets in a fully disconnected environment, ensure that you install the oc-mirror plug-in on the host with internet access and the host in the disconnected environment with access to the mirror registry.

Prerequisites
  • You have installed the OpenShift CLI (oc).

Procedure
  1. Download the oc-mirror CLI plug-in.

    1. Navigate to the Downloads page of the OpenShift Cluster Manager.

    2. Under the OpenShift disconnected installation tools section, click Download for OpenShift Client (oc) mirror plugin and save the file.

  2. Extract the archive:

    $ tar xvzf oc-mirror.tar.gz
  3. If necessary, update the plug-in file to be executable:

    $ chmod +x oc-mirror

    Do not rename the oc-mirror file.

  4. Install the oc-mirror CLI plug-in by placing the file in your PATH, for example, /usr/local/bin:

    $ sudo mv oc-mirror /usr/local/bin/.
Verification
  • Run oc mirror help to verify that the plug-in was successfully installed:

    $ oc mirror help
Additional resources

Configuring credentials that allow images to be mirrored

Create a container image registry credentials file that allows mirroring images from Red Hat to your mirror.

Do not use this image registry credentials file as the pull secret when you install a cluster. If you provide this file when you install cluster, all of the machines in the cluster will have write access to your mirror registry.

This process requires that you have write access to a container image registry on the mirror registry and adds the credentials to a registry pull secret.

Prerequisites
  • You configured a mirror registry to use in your restricted network.

  • You identified an image repository location on your mirror registry to mirror images into.

  • You provisioned a mirror registry account that allows images to be uploaded to that image repository.

Procedure

Complete the following steps on the installation host:

  1. Generate the base64-encoded user name and password or token for your mirror registry:

    $ echo -n '<user_name>:<password>' | base64 -w0 (1)
    BGVtbYk3ZHAtqXs=
    1 For <user_name> and <password>, specify the user name and password that you configured for your registry.
  2. Create a .json file and add a section that describes your registry to it:

    {
      "auths": {
        "<mirror_registry>": { (1)
          "auth": "<credentials>", (2)
          "email": "you@example.com"
        }
      }
    }
    1 For <mirror_registry>, specify the registry domain name, and optionally the port, that your mirror registry uses to serve content. For example, registry.example.com or registry.example.com:8443
    2 For <credentials>, specify the base64-encoded user name and password for the mirror registry.

Creating the image set configuration

Before you can use the oc-mirror plug-in to mirror image sets, you must create an image set configuration file. This image set configuration file defines which OKD releases, Operators, and other images to mirror, along with other configuration settings for the oc-mirror plug-in.

You must specify a storage backend in the image set configuration file. This storage backend can be a local directory or a registry that supports Docker v2-2. The oc-mirror plug-in stores metadata in this storage backend during image set creation.

Do not delete or modify the metadata that is generated by the oc-mirror plug-in. You must use the same storage backend every time you run the oc-mirror plug-in for the same mirror registry.

Prerequisites
  • You have created a container image registry credentials file. For instructions, see Configuring credentials that allow images to be mirrored.

Procedure
  1. Use the oc mirror init command to create a template for the image set configuration and save it to a file called imageset-config.yaml:

    $ oc mirror init --registry example.com/mirror/oc-mirror-metadata > imageset-config.yaml (1)
    1 Replace example.com/mirror/oc-mirror-metadata with the location of your registry for the storage backend.
  2. Edit the file and adjust the settings as necessary:

    kind: ImageSetConfiguration
    apiVersion: mirror.openshift.io/v1alpha2
    archiveSize: 4                                                      (1)
    storageConfig:                                                      (2)
      registry:
        imageURL: example.com/mirror/oc-mirror-metadata                 (3)
        skipTLS: false
    mirror:
      platform:
        channels:
        - name: stable-4.11                                             (4)
          type: ocp
        graph: true                                                     (5)
      operators:
      - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11  (6)
        packages:
        - name: serverless-operator                                     (7)
          channels:
          - name: stable
      additionalImages:
      - name: registry.redhat.io/ubi8/ubi:latest                        (8)
      helm: {}
    1 Add archiveSize to set the maximum size, in GiB, of each file within the image set.
    2 Set the back-end location to save the image set metadata to. This location can be a registry or local directory. It is required to specify storageConfig values.
    3 Set the registry URL for the storage backend.
    4 Set the channel to retrieve the OKD images from.
    5 Add graph: true to generate the OpenShift Update Service (OSUS) graph image to allow for an improved cluster update experience when using the web console. For more information, see About the OpenShift Update Service.
    6 Set the Operator catalog to retrieve the OKD images from.
    7 Specify only certain Operator packages and channels to include in the image set. Remove this field to retrieve all packages in the catalog.
    8 Specify any additional images to include in image set.

    See Image set configuration parameters for the full list of parameters and Image set configuration examples for various mirroring use cases.

  3. Save the updated file.

    This image set configuration file is required by the oc mirror command when mirroring content.

Mirroring an image set to a mirror registry

You can use the oc-mirror CLI plug-in to mirror images to a mirror registry in a partially disconnected environment or in a fully disconnected environment.

These procedures assume that you already have your mirror registry set up.

Mirroring an image set in a partially disconnected environment

In a partially disconnected environment, you can mirror an image set directly to the target mirror registry.

Mirroring from mirror to mirror

You can use the oc-mirror plug-in to mirror an image set directly to a target mirror registry that is accessible during image set creation.

You are required to specify a storage backend in the image set configuration file. This storage backend can be a local directory or a Docker v2 registry. The oc-mirror plug-in stores metadata in this storage backend during image set creation.

Do not delete or modify the metadata that is generated by the oc-mirror plug-in. You must use the same storage backend every time you run the oc-mirror plug-in for the same mirror registry.

Prerequisites
  • You have access to the internet to obtain the necessary container images.

  • You have installed the OpenShift CLI (oc).

  • You have installed the oc-mirror CLI plug-in.

  • You have created the image set configuration file.

Procedure
  • Run the oc mirror command to mirror the images from the specified image set configuration to a specified registry:

    $ oc mirror --config=./imageset-config.yaml \(1)
      docker://registry.example:5000             (2)
    1 Pass in the image set configuration file that was created. This procedure assumes that it is named imageset-config.yaml.
    2 Specify the registry to mirror the image set file to. The registry must start with docker://. If you specify a top-level namespace for the mirror registry, you must also use this same namespace on subsequent executions.
Verification
  1. Navigate into the oc-mirror-workspace/ directory that was generated.

  2. Navigate into the results directory, for example, results-1639608409/.

  3. Verify that YAML files are present for the ImageContentSourcePolicy and CatalogSource resources.

Next steps
  • Install the ImageContentSourcePolicy and CatalogSource resources into the cluster.

Mirroring an image set in a fully disconnected environment

To mirror an image set in a fully disconnected environment, you must first mirror the image set to disk, then mirror the image set file on disk to a mirror.

Mirroring from mirror to disk

You can use the oc-mirror plug-in to generate an image set and save the contents to disk. The generated image set can then be transferred to the disconnected environment and mirrored to the target registry.

Depending on the configuration specified in the image set configuration file, using oc-mirror to mirror images might download several hundreds of gigabytes of data to disk.

The initial image set download when you populate the mirror registry is often the largest. Because you only download the images that changed since the last time you ran the command, when you run the oc-mirror plug-in again, the generated image set is often smaller.

You are required to specify a storage backend in the image set configuration file. This storage backend can be a local directory or a docker v2 registry. The oc-mirror plug-in stores metadata in this storage backend during image set creation.

Do not delete or modify the metadata that is generated by the oc-mirror plug-in. You must use the same storage backend every time you run the oc-mirror plug-in for the same mirror registry.

Prerequisites
  • You have access to the internet to obtain the necessary container images.

  • You have installed the OpenShift CLI (oc).

  • You have installed the oc-mirror CLI plug-in.

  • You have created the image set configuration file.

Procedure
  • Run the oc mirror command to mirror the images from the specified image set configuration to disk:

    $ oc mirror --config=./imageset-config.yaml \(1)
      file://<path_to_output_directory>          (2)
    1 Pass in the image set configuration file that was created. This procedure assumes that it is named imageset-config.yaml.
    2 Specify the target directory where you want to output the image set file. The target directory path must start with file://.
Verification
  1. Navigate to your output directory:

    $ cd <path_to_output_directory>
  2. Verify that an image set .tar file was created:

    $ ls
    Example output
    mirror_seq1_000000.tar
Next steps
  • Transfer the image set .tar file to the disconnected environment.

Mirroring from disk to mirror

You can use the oc-mirror plug-in to mirror the contents of a generated image set to the target mirror registry.

Prerequisites
  • You have installed the OpenShift CLI (oc) in the disconnected environment.

  • You have installed the oc-mirror CLI plug-in in the disconnected environment.

  • You have generated the image set file by using the oc mirror command.

  • You have transferred the image set file to the disconnected environment.

Procedure
  • Run the oc mirror command to process the image set file on disk and mirror the contents to a target mirror registry:

    $ oc mirror --from=./mirror_seq1_000000.tar \(1)
      docker://registry.example:5000             (2)
    1 Pass in the image set .tar file to mirror, named mirror_seq1_000000.tar in this example. If an archiveSize value was specified in the image set configuration file, the image set might be broken up into multiple .tar files. In this situation, you can pass in a directory that contains the image set .tar files.
    2 Specify the registry to mirror the image set file to. The registry must start with docker://. If you specify a top-level namespace for the mirror registry, you must also use this same namespace on subsequent executions.

    This command updates the mirror registry with the image set and generates the ImageContentSourcePolicy and CatalogSource resources.

Verification
  1. Navigate into the oc-mirror-workspace/ directory that was generated.

  2. Navigate into the results directory, for example, results-1639608409/.

  3. Verify that YAML files are present for the ImageContentSourcePolicy and CatalogSource resources.

Next steps
  • Install the ImageContentSourcePolicy and CatalogSource resources into the cluster.

Installing the ImageContentSourcePolicy and CatalogSource resources into the cluster

After you have mirrored your image set to the mirror registry, you must install the generated ImageContentSourcePolicy and CatalogSource resources into the cluster.

The ImageContentSourcePolicy resource associates the mirror registry with the source registry and redirects image pull requests from the online registries to the mirror registry. The CatalogSource resource is used by Operator Lifecycle Manager (OLM) to retrieve information about the available Operators in the mirror registry.

Prerequisites
  • You have mirrored the image set to the registry mirror in the disconnected environment.

  • You have access to the cluster as a user with the cluster-admin role.

Procedure
  1. Log in to the OpenShift CLI as a user with the cluster-admin role.

  2. Apply the YAML files from the results directory to the cluster:

    $ oc apply -f ./oc-mirror-workspace/results-1639608409/
Verification
  1. Verify that the ImageContentSourcePolicy resources were successfully installed:

    $ oc get imagecontentsourcepolicy --all-namespaces
  2. Verify that the CatalogSource resources were successfully installed:

    $ oc get catalogsource --all-namespaces

Keeping your mirror registry content updated

After your target mirror registry is populated with the initial image set, be sure to update it regularly so that it has the latest content. You can optionally set up a cron job, if possible, so that the mirror registry is updated on a regular basis.

Ensure that you update your image set configuration to add or remove OKD and Operator releases as necessary. Any images that are removed are pruned from the mirror registry.

About updating your mirror registry content

When you run the oc-mirror plug-in again, it generates an image set that only contains new and updated images since the previous execution. Because it only pulls in the differences since the previous image set was created, the generated image set is often smaller and faster to process than the initial image set.

Generated image sets are sequential and must be pushed to the target mirror registry in order. You can derive the sequence number from the file name of the generated image set archive file.

Adding new and updated images

Depending on the settings in your image set configuration, future executions of oc-mirror can mirror additional new and updated images. Review the settings in your image set configuration to ensure that you are retrieving new versions as necessary. For example, you can set the minimum and maximum versions of Operators to mirror if you want to restrict to specific versions. Alternatively, you can set the minimum version as a starting point to mirror, but keep the version range open so you keep receiving new Operator versions on future executions of oc-mirror. Omitting any minimum or maximum version gives you the full version history of an Operator in a channel. Omitting explicitly named channels gives you all releases in all channels of the specified Operator. Omitting any named Operator gives you the entire catalog of all Operators and all their versions ever released.

All these constraints and conditions are evaluated against the publicly released content by Red Hat on every invocation of oc-mirror. This way, it automatically picks up new releases and entirely new Operators. Constraints can be specified by only listing a desired set of Operators, which will not automatically add other newly released Operators into the mirror set. You can also specify a particular release channel, which limits mirroring to just this channel and not any new channels that have been added. This is important for Operator products, such as Red Hat Quay, that use different release channels for their minor releases. Lastly, you can specify a maximum version of a particular Operator, which causes the tool to only mirror the specified version range so that you do not automatically get any newer releases past the maximum version mirrored. In all these cases, you must update the image set configuration file to broaden the scope of the mirroring of Operators to get other Operators, new channels, and newer versions of Operators to be available in your target registry.

It is recommended to align constraints like channel specification or version ranges with the release strategy that a particular Operator has chosen. For example, when the Operator uses a stable channel, you should restrict mirroring to that channel and potentially a minimum version to find the right balance between download volume and getting stable updates regularly. If the Operator chooses a release version channel scheme, for example stable-3.7, you should mirror all releases in that channel. This allows you to keep receiving patch versions of the Operator, for example 3.7.1. You can also regularly adjust the image set configuration to add channels for new product releases, for example stable-3.8.

Pruning images

Images are pruned automatically from the target mirror registry if they are no longer included in the latest image set that was generated and mirrored. This allows you to easily manage and clean up unneeded content and reclaim storage resources.

If there are OKD releases or Operator versions that you no longer need, you can modify your image set configuration to exclude them, and they will be pruned from the mirror registry upon mirroring. This can be done by adjusting a minimum or maximum version range setting per Operator in the image set configuration file or by deleting the Operator from the list of Operators to mirror from the catalog. You can also remove entire Operator catalogs or entire OKD releases from the configuration file.

If there are no new or updated images to mirror, the excluded images are not pruned from the target mirror registry. Additionally, if an Operator publisher removes an Operator version from a channel, the removed versions are pruned from the target mirror registry.

Updating your mirror registry content

After you publish the initial image set to the mirror registry, you can use the oc-mirror plug-in to keep your disconnected clusters updated.

Depending on your image set configuration, oc-mirror automatically detects newer releases of OKD and your selected Operators that have been released after you completed the inital mirror. It is recommended to run oc-mirror at regular intervals, for example in a nightly cron job, to receive product and security updates on a timely basis.

Prerequisites
  • You have used the oc-mirror plug-in to mirror the initial image set to your mirror registry.

  • You have access to the storage backend that was used for the initial execution of the oc-mirror plug-in.

    You must use the same storage backend as the initial execution of oc-mirror for the same mirror registry. Do not delete or modify the metadata image that is generated by the oc-mirror plug-in.

Procedure
  1. If necessary, update your image set configuration file to pick up new OKD and Operator versions. See Image set configuration examples for example mirroring use cases.

  2. Follow the same steps that you used to mirror your initial image set to the mirror registry. For instructions, see Mirroring an image set in a partially disconnected environment or Mirroring an image set in a fully disconnected environment.

    • You must provide the same storage backend so that only a differential image set is created and mirrored.

    • If you specified a top-level namespace for the mirror registry during the initial image set creation, then you must use this same namespace every time you run the oc-mirror plug-in for the same mirror registry.

  3. Install the ImageContentSourcePolicy and CatalogSource resources into the cluster.

Performing a dry run

You can use oc-mirror to perform a dry run, without actually mirroring any images. This allows you to review the list of images that would be mirrored, as well as any images that would be pruned from the mirror registry. It also allows you to catch any errors with your image set configuration early or use the generated list of images with other tools to carry out the mirroring operation.

Prerequisites
  • You have access to the internet to obtain the necessary container images.

  • You have installed the OpenShift CLI (oc).

  • You have installed the oc-mirror CLI plug-in.

  • You have created the image set configuration file.

Procedure
  1. Run the oc mirror command with the --dry-run flag to perform a dry run:

    $ oc mirror --config=./imageset-config.yaml \(1)
      docker://registry.example:5000            \(2)
      --dry-run                                  (3)
    1 Pass in the image set configuration file that was created. This procedure assumes that it is named imageset-config.yaml.
    2 Specify the mirror registry. Nothing is mirrored to this registry as long as you use the --dry-run flag.
    3 Use the --dry-run flag to generate the dry run artifacts and not an actual image set file.
    Example output
    Checking push permissions for registry.example:5000
    Creating directory: oc-mirror-workspace/src/publish
    Creating directory: oc-mirror-workspace/src/v2
    Creating directory: oc-mirror-workspace/src/charts
    Creating directory: oc-mirror-workspace/src/release-signatures
    No metadata detected, creating new workspace
    wrote mirroring manifests to oc-mirror-workspace/operators.1658342351/manifests-redhat-operator-index
    
    ...
    
    info: Planning completed in 31.48s
    info: Dry run complete
    Writing image mapping to oc-mirror-workspace/mapping.txt
  2. Navigate into the workspace directory that was generated:

    $ cd oc-mirror-workspace/
  3. Review the mapping.txt file that was generated.

    This file contains a list of all images that would be mirrored.

  4. Review the pruning-plan.json file that was generated.

    This file contains a list of all images that would be pruned from the mirror registry when the image set is published.

    The pruning-plan.json file is only generated if your oc-mirror command points to your mirror registry and there are images to be pruned.

Image set configuration parameters

The oc-mirror plug-in requires an image set configuration file that defines what images to mirror. The following table lists the available parameters for the ImageSetConfiguration resource.

Table 1. ImageSetConfiguration parameters
Parameter Description Values

apiVersion

The API version for the ImageSetConfiguration content.

String. For example: mirror.openshift.io/v1alpha2.

archiveSize

The maximum size, in GiB, of each archive file within the image set.

Integer. For example: 4

mirror

The configuration of the image set.

Object

mirror.additionalImages

The additional images configuration of the image set.

Array of objects. For example:

additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest

mirror.additionalImages.name

The tag or digest of the image to mirror.

String. For example: registry.redhat.io/ubi8/ubi:latest

mirror.blockedImages

The full tag, digest, or pattern of images to block from mirroring.

Array of strings. For example: docker.io/library/alpine

mirror.helm

The helm configuration of the image set. Note that the oc-mirror plug-in supports only helm charts that do not require user input when rendered.

Object

mirror.helm.local

The local helm charts to mirror.

Array of objects. For example:

local:
  - name: podinfo
    path: /test/podinfo-5.0.0.tar.gz

mirror.helm.local.name

The name of the local helm chart to mirror.

String. For example: podinfo.

mirror.helm.local.path

The path of the local helm chart to mirror.

String. For example: /test/podinfo-5.0.0.tar.gz.

mirror.helm.repositories

The remote helm repositories to mirror from.

Array of objects. For example:

repositories:
  - name: podinfo
    url: https://example.github.io/podinfo
    charts:
      - name: podinfo
        version: 5.0.0

mirror.helm.repositories.name

The name of the helm repository to mirror from.

String. For example: podinfo.

mirror.helm.repositories.url

The URL of the helm repository to mirror from.

String. For example: https://example.github.io/podinfo.

mirror.helm.repositories.charts

The remote helm charts to mirror.

Array of objects.

mirror.helm.repositories.charts.name

The name of the helm chart to mirror.

String. For example: podinfo.

mirror.helm.repositories.charts.version

The version of the named helm chart to mirror.

String. For example: 5.0.0.

mirror.operators

The Operators configuration of the image set.

Array of objects. For example:

operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
    packages:
      - name: elasticsearch-operator
        minVersion: '2.4.0'

mirror.operators.catalog

The Operator catalog to include in the image set.

String. For example: registry.redhat.io/redhat/redhat-operator-index:v4.11.

mirror.operators.full

When true, downloads the full catalog, Operator package, or Operator channel.

Boolean. The default value is false.

mirror.operators.packages

The Operator packages configuration.

Array of objects. For example:

operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
    packages:
      - name: elasticsearch-operator
        minVersion: '5.2.3-31'

mirror.operators.packages.name

The Operator package name to include in the image set

String. For example: elasticsearch-operator.

mirror.operators.packages.channels

The Operator package channel configuration.

Object

mirror.operators.packages.channels.name

The Operator channel name, unique within a package, to include in the image set.

String. For example: fast or stable-v4.11.

mirror.operators.packages.channels.maxVersion

The highest version of the Operator mirror across all channels in which it exists.

String. For example: 5.2.3-31

mirror.operators.packages.channels.minBundle

The name of the minimum bundle to include, plus all bundles in the upgrade graph to the channel head. Set this field only if the named bundle has no semantic version metadata.

String. For example: bundleName

mirror.operators.packages.channels.minVersion

The lowest version of the Operator to mirror across all channels in which it exists.

String. For example: 5.2.3-31

mirror.operators.packages.maxVersion

The highest version of the Operator to mirror across all channels in which it exists.

String. For example: 5.2.3-31.

mirror.operators.packages.minVersion

The lowest version of the Operator to mirror across all channels in which it exists.

String. For example: 5.2.3-31.

mirror.operators.skipDependencies

If true, dependencies of bundles are not included.

Boolean. The default value is false.

mirror.operators.targetName

Optional alternative name to mirror the referenced catalog as.

String. For example: my-operator-catalog

mirror.operators.targetTag

Optional alternative tag to append to the targetName.

String. For example: v1

mirror.platform

The platform configuration of the image set.

Object

mirror.platform.architecture

The architecture of the platform release payload to mirror.

Array of strings. For example:

architectures:
  - amd64
  - arm64

mirror.platform.channels

The platform channel configuration of the image set.

Array of objects. For example:

channels:
  - name: stable-4.10
  - name: stable-4.11

mirror.platform.channels.full

When true, sets the minVersion to the first release in the channel and the maxVersion to the last release in the channel.

Boolean. The default value is false.

mirror.platform.channels.name

The name of the release channel.

String. For example: stable-4.11

mirror.platform.channels.minVersion

The minimum version of the referenced platform to be mirrored.

String. For example: 4.9.6

mirror.platform.channels.maxVersion

The highest version of the referenced platform to be mirrored.

String. For example: 4.11.1

mirror.platform.channels.shortestPath

Toggles shortest path mirroring or full range mirroring.

Boolean. The default value is false.

mirror.platform.channels.type

The type of the platform to be mirrored.

String. For example: ocp or okd. The default is ocp.

mirror.platform.graph

Indicates whether the OSUS graph is added to the image set and subsequently published to the mirror.

Boolean. The default value is false.

storageConfig

The back-end configuration of the image set.

Object

storageConfig.local

The local back-end configuration of the image set.

Object

storageConfig.local.path

The path of the directory to contain the image set metadata.

String. For example: ./path/to/dir/.

storageConfig.registry

The registry back-end configuration of the image set.

Object

storageConfig.registry.imageURL

The back-end registry URI. Can optionally include a namespace reference in the URI.

String. For example: quay.io/myuser/imageset:metadata.

storageConfig.registry.skipTLS

Optionally skip TLS verification of the referenced back-end registry.

Boolean. The default value is false.

Image set configuration examples

The following ImageSetConfiguration file examples show the configuration for various mirroring use cases.

Use case: Including arbitrary images and helm charts

The following ImageSetConfiguration file uses a registry storage backend and includes helm charts and an additional Red Hat Universal Base Image (UBI).

Example ImageSetConfiguration file
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
archiveSize: 4
storageConfig:
 registry:
   imageURL: example.com/mirror/oc-mirror-metadata
   skipTLS: false
mirror:
 platform:
   architectures:
     - "s390x"
   channels:
     - name: stable-4.11
 operators:
   - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
 helm:
   repositories:
     - name: redhat-helm-charts
       url: https://raw.githubusercontent.com/redhat-developer/redhat-helm-charts/master
       charts:
         - name: ibm-mongodb-enterprise-helm
           version: 0.2.0
 additionalImages:
   - name: registry.redhat.io/ubi8/ubi:latest

Use case: Including Operator versions from a minimum to the latest

The following ImageSetConfiguration file uses a local storage backend and includes only the Red Hat Advanced Cluster Security for Kubernetes Operator, versions starting at 3.68.0 and later in the latest channel.

Example ImageSetConfiguration file
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
      packages:
        - name: rhacs-operator
          channels:
          - name: latest
            minVersion: 3.68.0

Use case: Including the shortest OKD upgrade path

The following ImageSetConfiguration file uses a local storage backend and includes all OKD versions along the shortest upgrade path from the minimum version of 4.9.37 to the maximum version of 4.10.22.

Example ImageSetConfiguration file
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.10
        minVersion: 4.9.37
        maxVersion: 4.10.22
        shortestPath: true

Use case: Including all versions of OKD from a minimum to the latest

The following ImageSetConfiguration file uses a registry storage backend and includes all OKD versions starting at a minimum version of 4.10.10 to the latest version in the channel.

On every invocation of oc-mirror with this image set configuration, the latest release of the stable-4.10 channel is evaluated, so running oc-mirror at regular intervals ensures that you automatically receive the latest releases of OKD images.

Example ImageSetConfiguration file
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
 registry:
   imageURL: example.com/mirror/oc-mirror-metadata
   skipTLS: false
mirror:
  platform:
    channels:
      - name: stable-4.10
        minVersion: 4.10.10

Use case: Including Operator versions from a minimum to a maximum

The following ImageSetConfiguration file uses a local storage backend and includes only an example Operator, versions starting at 1.0.0 through 2.0.0 in the stable channel.

This allows you to only mirror a specific version range of a particular Operator. As time progresses, you can use these settings to adjust the version to newer releases, for example when you no longer have version 1.0.0 running anywhere anymore. In this scenario, you can increase the minVersion to something newer, for example 1.5.0. When oc-mirror runs again with the updated version range, it automatically detects that any releases older than 1.5.0 are no longer required and deletes those from the registry to conserve storage space.

Example ImageSetConfiguration file
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      packages:
        - name: example-operator
          channels:
            - name: stable
              minVersion: '1.0.0'
              maxVersion: '2.0.0'

Command reference for oc-mirror

The following tables describe the oc mirror subcommands and flags:

Table 2. oc mirror subcommands
Subcommand Description

completion

Generate the autocompletion script for the specified shell.

describe

Output the contents of an image set.

help

Show help about any subcommand.

init

Output an initial image set configuration template.

list

List available platform and Operator content and their version.

version

Output the oc-mirror version.

Table 3. oc mirror flags
Flag Description

-c, --config <string>

Specify the path to an image set configuration file.

--continue-on-error

If any non image-pull related error occurs, continue and attempt to mirror as much as possible.

--dest-skip-tls

Disable TLS validation for the target registry.

--dest-use-http

Use plain HTTP for the target registry.

--dry-run

Print actions without mirroring images. Generates mapping.txt and pruning-plan.json files.

--from <string>

Specify the path to an image set archive that was generated by an execution of oc-mirror to load into a target registry.

-h, --help

Show the help.

--ignore-history

Ignore past mirrors when downloading images and packing layers. Disables incremental mirroring and might download more data.

--manifests-only

Generate manifests for ImageContentSourcePolicy and CatalogSource objects to configure a cluster to use the mirror registry, but do not actually mirror any images.

--max-per-registry <int>

Specify the number of concurrent requests allowed per registry. The default is 6.

--skip-cleanup

Skip removal of artifact directories.

--skip-image-pin

Do not replace image tags with digest pins in Operator catalogs.

--skip-metadata-check

Skip metadata when publishing an image set. This is only recommended when the image set was created with --ignore-history.

--skip-missing

If an image is not found, skip it instead of reporting an error and aborting execution. Does not apply to custom images explicitly specified in the image set configuration.

--skip-verification

Skip digest verification.

--source-skip-tls

Disable TLS validation for the source registry.

--source-use-http

Use plain HTTP for the source registry.

-v, --verbose <int>

Specify the number for the log level verbosity. Valid values are 0 - 9. The default is 0.