$ tar xvf <file>
You must mirror container images onto a mirror registry before you can update a cluster in a disconnected environment. You can also use this procedure in connected environments to ensure your clusters run only approved container images that have satisfied your organizational controls for external content.
Your mirror registry must be running at all times while the cluster is running. |
The following steps outline the high-level workflow on how to mirror images to a mirror registry:
Install the OpenShift CLI (oc
) on all devices being used to retrieve and push release images.
Download the registry pull secret and add it to your cluster.
If you use the oc-mirror OpenShift CLI (oc
) plugin:
Install the oc-mirror plugin on all devices being used to retrieve and push release images.
Create an image set configuration file for the plugin to use when determining which release images to mirror. You can edit this configuration file later to change which release images that the plugin mirrors.
Mirror your targeted release images directly to a mirror registry, or to removable media and then to a mirror registry.
Configure your cluster to use the resources generated by the oc-mirror plugin.
Repeat these steps as needed to update your mirror registry.
If you use the oc adm release mirror
command:
Set environment variables that correspond to your environment and the release images you want to mirror.
Mirror your targeted release images directly to a mirror registry, or to removable media and then to a mirror registry.
Repeat these steps as needed to update your mirror registry.
Compared to using the oc adm release mirror
command, the oc-mirror plugin has the following advantages:
It can mirror content other than container images.
After mirroring images for the first time, it is easier to update images in the registry.
The oc-mirror plugin provides an automated way to mirror the release payload from Quay, and also builds the latest graph data image for the OpenShift Update Service running in the disconnected environment.
You must have a container image registry that supports Docker v2-2 in the location that will host the OpenShift Container Platform cluster, such as Red Hat Quay.
If you use Red Hat Quay, you must use version 3.6 or later with the oc-mirror plugin. 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 have an existing solution for a container image registry, the mirror registry for Red Hat OpenShift is included in OpenShift Container Platform subscriptions. The mirror registry for Red Hat OpenShift is a small-scale container registry that you can use to mirror OpenShift Container Platform container images in disconnected installations and updates.
Before you perform the mirror procedure, you must prepare the host to retrieve content and push it to the remote location.
You can install the OpenShift CLI (oc
) to interact with OpenShift Container Platform from a
command-line interface. You can install oc
on Linux, Windows, or macOS.
If you installed an earlier version of |
You can install the OpenShift CLI (oc
) binary on Linux by using the following procedure.
Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
Select the architecture in the Product Variant drop-down menu.
Select the appropriate version in the Version drop-down menu.
Click Download Now next to the OpenShift v4.11 Linux Client entry and save the file.
Unpack the archive:
$ tar xvf <file>
Place the oc
binary in a directory that is on your PATH
.
To check your PATH
, execute the following command:
$ echo $PATH
After you install the OpenShift CLI, it is available using the oc
command:
$ oc <command>
You can install the OpenShift CLI (oc
) binary on Windows by using the following procedure.
Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
Select the appropriate version in the Version drop-down menu.
Click Download Now next to the OpenShift v4.11 Windows Client entry and save the file.
Unzip the archive with a ZIP program.
Move the oc
binary to a directory that is on your PATH
.
To check your PATH
, open the command prompt and execute the following command:
C:\> path
After you install the OpenShift CLI, it is available using the oc
command:
C:\> oc <command>
You can install the OpenShift CLI (oc
) binary on macOS by using the following procedure.
Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
Select the appropriate version in the Version drop-down menu.
Click Download Now next to the OpenShift v4.11 macOS Client entry and save the file.
For macOS arm64, choose the OpenShift v4.11 macOS arm64 Client entry. |
Unpack and unzip the archive.
Move the oc
binary to a directory on your PATH.
To check your PATH
, open a terminal and execute the following command:
$ echo $PATH
After you install the OpenShift CLI, it is available using the oc
command:
$ oc <command>
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. |
You configured a mirror registry to use in your disconnected environment.
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.
Complete the following steps on the installation host:
Download your registry.redhat.io
pull secret from the Red Hat OpenShift Cluster Manager.
Make a copy of your pull secret in JSON format:
$ cat ./pull-secret | jq . > <path>/<pull_secret_file_in_json> (1)
1 | Specify the path to the folder to store the pull secret in and a name for the JSON file that you create. |
The contents of the file resemble the following example:
{
"auths": {
"cloud.openshift.com": {
"auth": "b3BlbnNo...",
"email": "you@example.com"
},
"quay.io": {
"auth": "b3BlbnNo...",
"email": "you@example.com"
},
"registry.connect.redhat.com": {
"auth": "NTE3Njg5Nj...",
"email": "you@example.com"
},
"registry.redhat.io": {
"auth": "NTE3Njg5Nj...",
"email": "you@example.com"
}
}
}
Optional: If using the oc-mirror plugin, save the file either as ~/.docker/config.json
or $XDG_RUNTIME_DIR/containers/auth.json
.
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. |
Edit the 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. |
The file resembles the following example:
{
"auths": {
"registry.example.com": {
"auth": "BGVtbYk3ZHAtqXs=",
"email": "you@example.com"
},
"cloud.openshift.com": {
"auth": "b3BlbnNo...",
"email": "you@example.com"
},
"quay.io": {
"auth": "b3BlbnNo...",
"email": "you@example.com"
},
"registry.connect.redhat.com": {
"auth": "NTE3Njg5Nj...",
"email": "you@example.com"
},
"registry.redhat.io": {
"auth": "NTE3Njg5Nj...",
"email": "you@example.com"
}
}
}
You can use the oc-mirror OpenShift CLI (oc
) plugin 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 to download the required images from the official Red Hat registries.
You can use the oc-mirror OpenShift CLI (oc
) plugin to mirror all required OpenShift Container Platform content and other images to your mirror registry by using a single tool. It provides the following features:
Provides a centralized method to mirror OpenShift Container Platform releases, Operators, helm charts, and other images.
Maintains update paths for OpenShift Container Platform and Operators.
Uses a declarative image set configuration file to include only the OpenShift Container Platform 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 plugin, 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 OpenShift Container Platform releases and Operators that your cluster needs. This reduces the amount of data that you need to download and transfer. The oc-mirror plugin 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 plugin, it populates your mirror registry with the required content to perform your disconnected cluster installation or update. 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 plugin using the same configuration as the first time you ran it. The oc-mirror plugin 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 OpenShift Container Platform and Operators and performs dependency resolution as required.
When using the oc-mirror CLI plugin to populate a mirror registry, any further updates to the mirror registry must be made using the oc-mirror tool. |
The oc-mirror plugin supports mirroring OpenShift Container Platform payload images and Operator catalogs for OpenShift Container Platform versions 4.9 and later.
Use the latest available version of the oc-mirror plugin regardless of which versions of OpenShift Container Platform you need to mirror.
If you used the Technology Preview version of the oc-mirror plugin for OpenShift Container Platform 4.10, it is not possible to migrate your mirror registry to OpenShift Container Platform 4.11. You must download the new oc-mirror plugin, use a new storage back end, and use a new top-level namespace on the target mirror registry. |
You can mirror the images that are required for OpenShift Container Platform 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 OpenShift Container Platform 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 OpenShift image registry 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 OpenShift Container Platform clusters.
When you populate your mirror registry with OpenShift Container Platform 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 OpenShift Container Platform. |
For information about viewing the CRI-O logs to view the image source, see Viewing the image pull source.
To use the oc-mirror OpenShift CLI plugin to mirror registry images, you must install the plugin. If you are mirroring image sets in a fully disconnected environment, ensure that you install the oc-mirror plugin on the host with internet access and the host in the disconnected environment with access to the mirror registry.
You have installed the OpenShift CLI (oc
).
Download the oc-mirror CLI plugin.
Navigate to the Downloads page of the OpenShift Cluster Manager Hybrid Cloud Console.
Under the OpenShift disconnected installation tools section, click Download for OpenShift Client (oc) mirror plugin and save the file.
Extract the archive:
$ tar xvzf oc-mirror.tar.gz
If necessary, update the plugin file to be executable:
$ chmod +x oc-mirror
Do not rename the |
Install the oc-mirror CLI plugin by placing the file in your PATH
, for example, /usr/local/bin
:
$ sudo mv oc-mirror /usr/local/bin/.
Run oc mirror help
to verify that the plugin was successfully installed:
$ oc mirror help
Before you can use the oc-mirror plugin to mirror image sets, you must create an image set configuration file. This image set configuration file defines which OpenShift Container Platform releases, Operators, and other images to mirror, along with other configuration settings for the oc-mirror plugin.
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 plugin stores metadata in this storage backend during image set creation.
Do not delete or modify the metadata that is generated by the oc-mirror plugin. You must use the same storage backend every time you run the oc-mirror plugin for the same mirror registry. |
You have created a container image registry credentials file. For instructions, see Configuring credentials that allow images to be mirrored.
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. |
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 (8)
additionalImages:
- name: registry.redhat.io/ubi8/ubi:latest (9)
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 OpenShift Container Platform images from. |
5 | Add graph: true to build and push the graph-data image to the mirror registry. The graph-data image is required to create OpenShift Update Service (OSUS). The graph: true field also generates the UpdateService custom resource manifest. The oc command-line interface (CLI) can use the UpdateService custom resource manifest to create OSUS. For more information, see About the OpenShift Update Service. |
6 | Set the Operator catalog to retrieve the OpenShift Container Platform images from. |
7 | Specify only certain Operator packages to include in the image set. Remove this field to retrieve all packages in the catalog. |
8 | Specify only certain channels of the Operator packages to include in the image set. You must always include the default channel for the Operator package even if you do not use the bundles in that channel. You can find the default channel by running the following command: oc mirror list operators --catalog=<catalog_name> --package=<package_name> . |
9 | 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.
Save the updated file.
This image set configuration file is required by the oc mirror
command when mirroring content.
You can use the oc-mirror CLI plugin to mirror images to a mirror registry in a partially disconnected environment or in a fully disconnected environment.
The following procedures assume that you already have your mirror registry set up.
In a partially disconnected environment, you can mirror an image set directly to the target mirror registry.
You can use the oc-mirror plugin 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 plugin stores metadata in this storage backend during image set creation.
Do not delete or modify the metadata that is generated by the oc-mirror plugin. You must use the same storage backend every time you run the oc-mirror plugin for the same mirror registry. |
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 plugin.
You have created the image set configuration file.
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. |
Navigate into the oc-mirror-workspace/
directory that was generated.
Navigate into the results directory, for example, results-1639608409/
.
Verify that YAML files are present for the ImageContentSourcePolicy
and CatalogSource
resources.
Configure your cluster to use the resources generated by oc-mirror.
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.
You can use the oc-mirror plugin 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 plugin 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 plugin stores metadata in this storage backend during image set creation.
Do not delete or modify the metadata that is generated by the oc-mirror plugin. You must use the same storage backend every time you run the oc-mirror plugin for the same mirror registry. |
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 plugin.
You have created the image set configuration file.
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:// . |
Navigate to your output directory:
$ cd <path_to_output_directory>
Verify that an image set .tar
file was created:
$ ls
mirror_seq1_000000.tar
Transfer the image set .tar file to the disconnected environment.
You can use the oc-mirror plugin to mirror the contents of a generated image set to the target mirror registry.
You have installed the OpenShift CLI (oc
) in the disconnected environment.
You have installed the oc-mirror
CLI plugin 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.
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.
Navigate into the oc-mirror-workspace/
directory that was generated.
Navigate into the results directory, for example, results-1639608409/
.
Verify that YAML files are present for the ImageContentSourcePolicy
and CatalogSource
resources.
Configure your cluster to use the resources generated by oc-mirror.
After you have mirrored your image set to the mirror registry, you must apply the generated ImageContentSourcePolicy
, CatalogSource
, and release image signature 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. The release image signatures are used to verify the mirrored release images.
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.
Log in to the OpenShift CLI as a user with the cluster-admin
role.
Apply the YAML files from the results directory to the cluster by running the following command:
$ oc apply -f ./oc-mirror-workspace/results-1639608409/
If you mirrored release images, apply the release image signatures to the cluster by running the following command:
$ oc apply -f ./oc-mirror-workspace/results-1639608409/release-signatures/
If you are mirroring Operators instead of clusters, you do not need to run |
Verify that the ImageContentSourcePolicy
resources were successfully installed by running the following command:
$ oc get imagecontentsourcepolicy --all-namespaces
Verify that the CatalogSource
resources were successfully installed by running the following command:
$ oc get catalogsource --all-namespaces
After you populate your target mirror registry with the initial image set, you must update it regularly so that it has the latest content. If possible, you can set up a cron job to update the mirror registry on a regular basis.
Update your image set configuration to add or remove OpenShift Container Platform and Operator releases as necessary. Removed images are pruned from the mirror registry.
When you run the oc-mirror plugin 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. |
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
.
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 OpenShift Container Platform 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 OpenShift Container Platform 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. |
After you publish the initial image set to the mirror registry, you can use the oc-mirror plugin to keep your disconnected clusters updated.
Depending on your image set configuration, oc-mirror automatically detects newer releases of OpenShift Container Platform 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.
You have used the oc-mirror plugin 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 plugin.
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 plugin. |
If necessary, update your image set configuration file to pick up new OpenShift Container Platform and Operator versions. See Image set configuration examples for example mirroring use cases.
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.
|
Configure your cluster to use the resources generated by oc-mirror.
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.
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 plugin.
You have created the image set configuration file.
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. |
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
Navigate into the workspace directory that was generated:
$ cd oc-mirror-workspace/
Review the mapping.txt
file that was generated.
This file contains a list of all images that would be mirrored.
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 |
The oc-mirror plugin requires an image set configuration file that defines what images to mirror. The following table lists the available parameters for the ImageSetConfiguration
resource.
Parameter | Description | Values |
---|---|---|
|
The API version for the |
String. For example: |
|
The maximum size, in GiB, of each archive file within the image set. |
Integer. For example: |
|
The configuration of the image set. |
Object |
|
The additional images configuration of the image set. |
Array of objects. For example:
|
|
The tag or digest of the image to mirror. |
String. For example: |
|
The full tag, digest, or pattern of images to block from mirroring. |
Array of strings. For example: |
|
The helm configuration of the image set. Note that the oc-mirror plugin supports only helm charts that do not require user input when rendered. |
Object |
|
The local helm charts to mirror. |
Array of objects. For example:
|
|
The name of the local helm chart to mirror. |
String. For example: |
|
The path of the local helm chart to mirror. |
String. For example: |
|
The remote helm repositories to mirror from. |
Array of objects. For example:
|
|
The name of the helm repository to mirror from. |
String. For example: |
|
The URL of the helm repository to mirror from. |
String. For example: |
|
The remote helm charts to mirror. |
Array of objects. |
|
The name of the helm chart to mirror. |
String. For example: |
|
The version of the named helm chart to mirror. |
String. For example: |
|
The Operators configuration of the image set. |
Array of objects. For example:
|
|
The Operator catalog to include in the image set. |
String. For example: |
|
When |
Boolean. The default value is |
|
The Operator packages configuration. |
Array of objects. For example:
|
|
The Operator package name to include in the image set |
String. For example: |
|
The Operator package channel configuration. |
Object |
|
The Operator channel name, unique within a package, to include in the image set. |
String. For example: |
|
The highest version of the Operator mirror across all channels in which it exists. |
String. For example: |
|
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: |
|
The lowest version of the Operator to mirror across all channels in which it exists. |
String. For example: |
|
The highest version of the Operator to mirror across all channels in which it exists. |
String. For example: |
|
The lowest version of the Operator to mirror across all channels in which it exists. |
String. For example: |
|
If |
Boolean. The default value is |
|
Optional alternative name to mirror the referenced catalog as. |
String. For example: |
|
Optional alternative tag to append to the |
String. For example: |
|
The platform configuration of the image set. |
Object |
|
The architecture of the platform release payload to mirror. |
Array of strings. For example:
|
|
The platform channel configuration of the image set. |
Array of objects. For example:
|
|
When |
Boolean. The default value is |
|
The name of the release channel. |
String. For example: |
|
The minimum version of the referenced platform to be mirrored. |
String. For example: |
|
The highest version of the referenced platform to be mirrored. |
String. For example: |
|
Toggles shortest path mirroring or full range mirroring. |
Boolean. The default value is |
|
The type of the platform to be mirrored. |
String. For example: |
|
Indicates whether the OSUS graph is added to the image set and subsequently published to the mirror. |
Boolean. The default value is |
|
The back-end configuration of the image set. |
Object |
|
The local back-end configuration of the image set. |
Object |
|
The path of the directory to contain the image set metadata. |
String. For example: |
|
The registry back-end configuration of the image set. |
Object |
|
The back-end registry URI. Can optionally include a namespace reference in the URI. |
String. For example: |
|
Optionally skip TLS verification of the referenced back-end registry. |
Boolean. The default value is |
The following ImageSetConfiguration
file examples show the configuration for various mirroring use cases.
The following ImageSetConfiguration
file uses a registry storage backend and includes helm charts and an additional Red Hat Universal Base Image (UBI).
ImageSetConfiguration
fileapiVersion: 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
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.
ImageSetConfiguration
fileapiVersion: 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
The following ImageSetConfiguration
file uses a local storage backend and includes all OpenShift Container Platform versions along the shortest upgrade path from the minimum version of 4.9.37
to the maximum version of 4.10.22
.
ImageSetConfiguration
fileapiVersion: 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
The following ImageSetConfiguration
file uses a registry storage backend and includes all OpenShift Container Platform 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 OpenShift Container Platform images.
ImageSetConfiguration
fileapiVersion: 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
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.
ImageSetConfiguration
fileapiVersion: 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: example-operator
channels:
- name: stable
minVersion: '1.0.0'
maxVersion: '2.0.0'
The following tables describe the oc mirror
subcommands and flags:
Subcommand | Description |
---|---|
|
Generate the autocompletion script for the specified shell. |
|
Output the contents of an image set. |
|
Show help about any subcommand. |
|
Output an initial image set configuration template. |
|
List available platform and Operator content and their version. |
|
Output the oc-mirror version. |
Flag | Description |
---|---|
|
Specify the path to an image set configuration file. |
|
If any non image-pull related error occurs, continue and attempt to mirror as much as possible. |
|
Disable TLS validation for the target registry. |
|
Use plain HTTP for the target registry. |
|
Print actions without mirroring images. Generates |
|
Specify the path to an image set archive that was generated by an execution of oc-mirror to load into a target registry. |
|
Show the help. |
|
Ignore past mirrors when downloading images and packing layers. Disables incremental mirroring and might download more data. |
|
Generate manifests for |
|
Specify the number of concurrent requests allowed per registry. The default is |
|
Skip removal of artifact directories. |
|
Do not replace image tags with digest pins in Operator catalogs. |
|
Skip metadata when publishing an image set. This is only recommended when the image set was created with |
|
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 digest verification. |
|
Disable TLS validation for the source registry. |
|
Use plain HTTP for the source registry. |
|
Specify the number for the log level verbosity. Valid values are |
To avoid excessive memory usage by the OpenShift Update Service application, you must mirror release images to a separate repository as described in the following procedure. |
You configured a mirror registry to use in your disconnected environment and can access the certificate and credentials that you configured.
You downloaded the pull secret from the Red Hat OpenShift Cluster Manager and modified it to include authentication to your mirror repository.
If you use self-signed certificates, you have specified a Subject Alternative Name in the certificates.
Use the Red Hat OpenShift Container Platform Upgrade Graph visualizer and update planner to plan an update from one version to another. The OpenShift Upgrade Graph provides channel graphs and a way to confirm that there is an update path between your current and intended cluster versions.
Set the required environment variables:
Export the release version:
$ export OCP_RELEASE=<release_version>
For <release_version>
, specify the tag that corresponds to the version of OpenShift Container Platform to which you want to update, such as 4.5.4
.
Export the local registry name and host port:
$ 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.
Export the local repository name:
$ LOCAL_REPOSITORY='<local_repository_name>'
For <local_repository_name>
, specify the name of the repository to create in your
registry, such as ocp4/openshift4
.
If you are using the OpenShift Update Service, export an additional local repository name to contain the release images:
$ 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
.
Export the name of the repository to mirror:
$ PRODUCT_REPO='openshift-release-dev'
For a production release, you must specify openshift-release-dev
.
Export the path to your registry pull secret:
$ 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.
If your cluster uses an |
Export the release mirror:
$ RELEASE_NAME="ocp-release"
For a production release, you must specify ocp-release
.
Export the type of architecture for your server, such as x86_64
.:
$ ARCHITECTURE=<server_architecture>
Export the path to the directory to host the mirrored images:
$ REMOVABLE_MEDIA_PATH=<path> (1)
1 | Specify the full path, including the initial forward slash (/) character. |
Review the images and configuration manifests to mirror:
$ oc adm release mirror -a ${LOCAL_secret_JSON} --to-dir=${REMOVABLE_MEDIA_PATH}/mirror quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE} --dry-run
Mirror the version images to the mirror registry.
If your mirror host does not have internet access, take the following actions:
Connect the removable media to a system that is connected to the internet.
Mirror the images and configuration manifests to a directory on the removable media:
$ oc adm release mirror -a ${LOCAL_secret_JSON} --to-dir=${REMOVABLE_MEDIA_PATH}/mirror quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE}
This command also generates and saves the mirrored release image signature config map onto the removable media. |
Take the media to the disconnected environment and upload the images to the local container registry.
$ oc image mirror -a ${LOCAL_secret_JSON} --from-dir=${REMOVABLE_MEDIA_PATH}/mirror "file://openshift/release:${OCP_RELEASE}*" ${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} (1)
1 | For REMOVABLE_MEDIA_PATH , you must use the same path that you specified when you mirrored the images. |
Use oc
command-line interface (CLI) to log in to the cluster that you are upgrading.
Apply the mirrored release image signature config map to the connected cluster:
$ oc apply -f ${REMOVABLE_MEDIA_PATH}/mirror/config/<image_signature_file> (1)
1 | For <image_signature_file> , specify the path and name of the file, for example, signature-sha256-81154f5c03294534.yaml . |
If you are using the OpenShift Update Service, mirror the release image to a separate repository:
$ 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 and the cluster are connected to the mirror host, take the following actions:
Directly push the release images to the local registry and apply the config map to the cluster by using following command:
$ oc adm release mirror -a ${LOCAL_secret_JSON} --from=quay.io/${PRODUCT_REPO}/${RELEASE_NAME}:${OCP_RELEASE}-${ARCHITECTURE} \
--to=${LOCAL_REGISTRY}/${LOCAL_REPOSITORY} --apply-release-image-signature
If you include the |
If you are using the OpenShift Update Service, mirror the release image to a separate repository:
$ oc image mirror -a ${LOCAL_secret_JSON} ${LOCAL_REGISTRY}/${LOCAL_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE} ${LOCAL_REGISTRY}/${LOCAL_RELEASE_IMAGES_REPOSITORY}:${OCP_RELEASE}-${ARCHITECTURE}