此内容没有您所选择的语言版本。
Chapter 5. Mirroring images for a disconnected installation by using the oc-mirror plugin v2
You can run your cluster in a disconnected environment if you install the cluster from a mirrored set of OpenShift Container Platform container images in a private registry. This registry must be running whenever your cluster is running.
You can use oc-mirror plugin v2 to mirror images to a mirror registry in your fully or partially disconnected environments. To download the required images from the official Red Hat registries, you must run oc-mirror plugin v2 from a system with internet connectivity.
5.1. About oc-mirror plugin v2 复制链接链接已复制到粘贴板!
The oc-mirror OpenShift CLI (oc
) plugin is a single tool that mirrors all required OpenShift Container Platform content and other images to your mirror registry.
To use the new version of oc-mirror, add the --v2
flag to the oc-mirror plugin v2 command line.
oc-mirror plugin v2 has the following features:
- Provides a centralized method to mirror OpenShift Container Platform releases, Operators, helm charts, and other images.
- Verifies that the complete image set specified in the image set configuration file is mirrored to the mirrored registry, regardless of whether the images were previously mirrored or not.
- Uses a cache system instead of metadata, which prevents the need to start the mirroring process over in the case of a failure for a single step of the process.
- Maintains minimal archive sizes by incorporating only new images into the archive.
- Generates mirroring archives with content selected by mirroring date.
-
Can generate
ImageDigestMirrorSet
(IDMS) andImageTagMirrorSet
(ITMS) resources, which cover the full image set, instead of anImageContentSourcePolicy
(ICSP) resource, which only covered incremental changes to the image set for each mirroring operation with v1. -
Does not perform automatic pruning. v2 now uses a
Delete
feature, which grants users more control over deleting images. -
Introduces support for
registries.conf
files. This change facilitates mirroring to multiple enclaves while using the same cache.
5.1.1. High level workflow 复制链接链接已复制到粘贴板!
The following steps outline the high-level workflow on how to use the oc-mirror plugin v2 to mirror images to a mirror registry:
- Create an image set configuration file.
Mirror the image set to the target mirror registry by using one of the following workflows:
- Mirror an image set directly to the target mirror registry (mirror to mirror).
-
Mirror an image set to disk (mirror to disk), transfer the
tar
file to the target environment, then mirror the image set to the target mirror registry (disk to mirror).
- Configure your cluster to use the resources generated by the oc-mirror plugin v2.
- Repeat these steps to update your target mirror registry as necessary.
5.1.2. oc-mirror plugin v2 compatibility and support 复制链接链接已复制到粘贴板!
The oc-mirror plugin v2 is supported for OpenShift Container Platform.
On aarch64
, ppc64le
, and s390x
architectures the oc-mirror plugin v2 is supported only for OpenShift Container Platform 4.14 and later.
Use the latest available version of the oc-mirror plugin v2 regardless of which versions of OpenShift Container Platform you need to mirror.
5.2. Prerequisites 复制链接链接已复制到粘贴板!
You must have a container image registry that supports Docker V2-2 in the location that hosts the OpenShift Container Platform cluster, such as Red Hat Quay.
Note- If you use Red Hat Quay, use version 3.6 or later with the oc-mirror plugin. See Deploying the Red Hat Quay Operator on OpenShift Container Platform (Red Hat Quay documentation). 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, OpenShift Container Platform subscribers receive a mirror registry for Red Hat OpenShift. This mirror registry is included with your subscription and serves as a small-scale container registry. You can use this registry to mirror the necessary container images of OpenShift Container Platform for disconnected installations.
- Every machine in the provisioned clusters must have access to the mirror registry. If the registry is unreachable, tasks like installation, updating, or routine operations such as workload relocation, might fail. Mirror registries must be operated in a highly available manner, ensuring their availability aligns with the production availability of your OpenShift Container Platform clusters.
5.3. Preparing your mirror hosts 复制链接链接已复制到粘贴板!
To use the oc-mirror plugin v2 for image mirroring, you must install the plugin and create a file with credentials for container images, enabling you to mirror from Red Hat to your mirror.
5.3.1. Installing the oc-mirror OpenShift CLI plugin 复制链接链接已复制到粘贴板!
Install the oc-mirror OpenShift CLI plugin to manage image sets in disconnected environments.
Prerequisites
You have installed the OpenShift CLI (
oc
). If you are mirroring image sets in a fully disconnected environment, ensure the following:- You have installed the oc-mirror plugin on the host that has internet access.
- The host in the disconnected environment has access to the target mirror registry.
-
You have set the
umask
parameter to0022
on the operating system that uses oc-mirror. - You have installed the correct binary for the RHEL version that you are using.
Procedure
Download the oc-mirror CLI plugin:
- Navigate to the Downloads page of the Red Hat Hybrid Cloud Console.
- In the OpenShift disconnected installation tools section, select the OS type and Architecture type of the OpenShift Client (oc) mirror plugin from the dropdown menus.
- Click Download to save the file.
Extract the archive by running the following command:
tar xvzf oc-mirror.tar.gz
$ tar xvzf oc-mirror.tar.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If necessary, update the plugin file to be executable by running the following command:
chmod +x oc-mirror
$ chmod +x oc-mirror
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteDo not rename the
oc-mirror
file.Install the oc-mirror CLI plugin by placing the file in your
PATH
, for example/usr/local/bin
, by running the following command:sudo mv oc-mirror /usr/local/bin/.
$ sudo mv oc-mirror /usr/local/bin/.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the oc-mirror plugin v2 is successfully installed by running the following command:
oc mirror --v2 --help
$ oc mirror --v2 --help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a container image registry credentials file that enables you to mirror 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.
Prerequisites
- 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.
- You have write access to the mirror registry.
Procedure
Complete the following steps on the installation host:
-
Download your
registry.redhat.io
pull secret from Red Hat OpenShift Cluster Manager. Make a copy of your pull secret in JSON format by running the following command:
cat ./pull-secret | jq . > <path>/<pull_secret_file_in_json>
$ cat ./pull-secret | jq . > <path>/<pull_secret_file_in_json>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the path to the folder to store the pull secret in and a name for the JSON file that you create.
Example pull secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the
$XDG_RUNTIME_DIR/containers
directory does not exist, create one by entering the following command:mkdir -p $XDG_RUNTIME_DIR/containers
$ mkdir -p $XDG_RUNTIME_DIR/containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save the pull secret file as
$XDG_RUNTIME_DIR/containers/auth.json
. Generate the base64-encoded user name and password or token for your mirror registry by running the following command:
echo -n '<user_name>:<password>' | base64 -w0
$ echo -n '<user_name>:<password>' | base64 -w0
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<user_name>
and<password>
, specify the user name and password that you configured for your registry.
Example output
BGVtbYk3ZHAtqXs=
BGVtbYk3ZHAtqXs=
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the JSON file and add a section that describes your registry to it:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example modified pull secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4. Mirroring an image set to a mirror registry 复制链接链接已复制到粘贴板!
Mirroring an image set to a mirror registry ensures that the required images are available in a secure and controlled environment, facilitating smoother deployments, updates, and maintenance tasks.
5.4.1. Creating the image set configuration 复制链接链接已复制到粘贴板!
Before you can use the oc-mirror plugin v2 to mirror images, 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 v2.
Prerequisites
- You have created a container image registry credentials file. For instructions, see Configuring credentials that allow images to be mirrored.
Procedure
Create an
ImageSetConfiguration
YAML file and modify it to include your required images.Example
ImageSetConfiguration
YAML fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Set the channel to retrieve OpenShift Container Platform images from.
- 2
- 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). Thegraph: true
field also generates theUpdateService
custom resource manifest. Theoc
command-line interface (CLI) can use theUpdateService
custom resource manifest to create OSUS. For more information, see About the OpenShift Update Service. - 3
- Set the Operator catalog to retrieve the OpenShift Container Platform images from.
- 4
- Specify only certain Operator packages to include in the image set. Remove this field to retrieve all packages in the catalog.
- 5
- Specify any additional images to include in image set.
You can mirror image sets to a registry using the oc-mirror plugin v2 in environments with restricted internet access.
Prerequisites
- You have access to the internet and the mirror registry in the environment where you are running the oc-mirror plugin v2.
Procedure
Mirror the images from the specified image set configuration to a specified registry by running the following command:
oc mirror -c <image_set_configuration> --workspace file://<file_path> docker://<mirror_registry_url> --v2
$ oc mirror -c <image_set_configuration> --workspace file://<file_path> docker://<mirror_registry_url> --v2
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <image_set_configuration>
- Specifies the name of the image set configuration file.
- <file_path>
- Specifies the directory where cluster resources will be generated in.
- <mirror_registry_url>
- Specifies the URL or address of the mirror registry where the images are stored and from which they need to be deleted.
Verification
-
Navigate to the
working-dir/cluster-resources
directory that was generated in the<file_path>
directory. -
Verify that the YAML files are present for the
ImageDigestMirrorSet
,ImageTagMirrorSet
, andCatalogSource
resources.
Next steps
- Configure your cluster to use the resources generated by oc-mirror plugin v2.
You can mirror image sets in a fully disconnected environment where the OpenShift Container Platform cluster cannot access the public internet. The following high-level workflow describes the mirroring process:
- Mirror to disk: Mirror the image set to an archive.
- Disk transfer: Manually transfer the archive to the network of the disconnected mirror registry.
- Disk to mirror: Mirror the image set from the archive to the target disconnected registry.
5.4.3.1. Mirroring from mirror to disk 复制链接链接已复制到粘贴板!
You can use the oc-mirror plugin v2 to generate an image set and save the content to disk. Afterwards, you can transfer the generated image set to the disconnected environment and mirror it to the target registry.
oc-mirror plugin v2 retrieves the container images from the source specified in the image set configuration file and packs them into a tar archive in a local directory.
Procedure
Mirror the images from the specified image set configuration to the disk by running the following command:
oc mirror -c <image_set_configuration> file://<file_path> --v2
$ oc mirror -c <image_set_configuration> file://<file_path> --v2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <image_set_configuration>
- Specifies the name of the image set configuration file.
- <file_path>
- Specifies the directory where the archives containing the image sets will be generated in.
Verification
-
Navigate to the
<file_path>
directory that was generated. - Verify that the archive files have been generated.
Next steps
- Mirroring from disk to mirror
5.4.3.2. Mirroring from disk to mirror 复制链接链接已复制到粘贴板!
You can use the oc-mirror plugin v2 to mirror image sets from a disk to a target mirror registry.
The oc-mirror plugin v2 retrieves container images from a local disk and transfers them to the specified mirror registry.
Procedure
- Transfer the disk containing mirrored image sets to the environment that contains the target mirror registry.
Process the image set file on the disk and mirror the contents to a target mirror registry by running the following command:
oc mirror -c <image_set_configuration> --from file://<file_path> docker://<mirror_registry_url> --v2
$ oc mirror -c <image_set_configuration> --from file://<file_path> docker://<mirror_registry_url> --v2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <image_set_configuration>
- Specifies the name of the image set configuration file.
- <file_path>
- Specifies the directory on the disk containing the archives. This folder will also contain cluster resources generated for you apply to the cluster, for example the ImageDigestMirrorSet (IDMS) or ImageTagMirrorSet (ITMS) resources.
- <mirror_registry_url>
- Specifies the URL or address of the mirror registry where the images are stored.
Verification
-
Navigate to the
cluster-resources
directory within theworking-dir
directory that was generated in the<file_path>
directory. -
Verify that the YAML files are present for the
ImageDigestMirrorSet
,ImageTagMirrorSet
, andCatalogSource
resources.
Next steps
- Configure your cluster to use the resources generated by oc-mirror plugin v2.
The oc-mirror plugin v2 automatically generates the following custom resources:
ImageDigestMirrorSet
(IDMS)- Handles registry mirror rules when using image digest pull specifications. Generated if at least one image of the image set is mirrored by digest.
ImageTagMirrorSet
(ITMS)- Handles registry mirror rules when using image tag pull specifications. Generated if at least one image from the image set is mirrored by tag.
CatalogSource
- Retrieves information about the available Operators in the mirror registry. Used by Operator Lifecycle Manager (OLM) Classic.
ClusterCatalog
- Retrieves information about the available cluster extensions (which includes Operators) in the mirror registry. Used by OLM v1.
UpdateService
- Provides update graph data to the disconnected environment. Used by the OpenShift Update Service.
When using resources that are generated by the oc-mirror plugin v2 to configure your cluster, you must not change certain fields. Modifying these fields can cause errors and is not supported.
The following table lists the resources and their fields that must remain unchanged:
Resource | Fields that must not be changed |
---|---|
|
|
|
|
|
|
|
|
Signature |
|
|
|
For more information about these resources, see the OpenShift API documentation for CatalogSource
, ImageDigestMirrorSet
, and ImageTagMirrorSet
.
After you have mirrored your image set to the mirror registry, you must apply the generated ImageDigestMirrorSet
(IDMS), ImageTagMirrorSet
(ITMS), CatalogSource
, and UpdateService
resources to the cluster.
In oc-mirror plugin v2, the IDMS and ITMS files cover the entire image set, unlike the ImageContentSourcePolicy
(ICSP) files in oc-mirror plugin v1. Therefore, the IDMS and ITMS files contain all images of the set even if you only add new images during incremental mirroring.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role.
Procedure
-
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 <path_to_oc_mirror_workspace>/working-dir/cluster-resources
$ oc apply -f <path_to_oc_mirror_workspace>/working-dir/cluster-resources
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you mirrored release images, apply the release image signatures to the cluster by running the following command:
oc apply -f working-dir/cluster-resources/signature-configmap.json
$ oc apply -f working-dir/cluster-resources/signature-configmap.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIf you are mirroring Operators instead of clusters, do not run the preceding command. Running the command results in an error because there are no release image signatures to apply.
Additionally, a YAML file is available in the same directory
working-dir/cluster-resources/
. You can use either the JSON or YAML format.
Verification
Verify that the
ImageDigestMirrorSet
resources are successfully installed by running the following command:oc get imagedigestmirrorset
$ oc get imagedigestmirrorset
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
ImageTagMirrorSet
resources are successfully installed by running the following command:oc get imagetagmirrorset
$ oc get imagetagmirrorset
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
CatalogSource
resources are successfully installed by running the following command:oc get catalogsource -n openshift-marketplace
$ oc get catalogsource -n openshift-marketplace
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
ClusterCatalog
resources are successfully installed by running the following command:oc get clustercatalog
$ oc get clustercatalog
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After your cluster is configured to use the resources generated by oc-mirror plugin v2, see Next steps for information about tasks that you can perform using your mirrored images.
If you have previously deployed images using the oc-mirror plugin v2, you can delete these images to free up space in your mirror registry. oc-mirror plugin v2 does not automatically prune images that are not included in the ImageSetConfiguration
file. This prevents accidentally deleting necessary or deployed images when making changes to the ImageSetConfig.yaml
file.
You must create a DeleteImageSetConfiguration
file to specify which images to delete.
In the following example, the DeleteImageSetConfiguration
file removes the following images:
- All release images for OpenShift Container Platform 4.13.3.
-
The
aws-load-balancer-operator
v0.0.1 bundle and all its related images. -
The additional images for
ubi
andubi-minimal
, referenced by their corresponding digests.
Example DeleteImageSetConfiguration
file
Consider using the mirror-to-disk and disk-to-mirror workflows to reduce deletion issues.
oc-mirror plugin v2 deletes only the manifests of the images, which does not reduce the storage occupied in the registry.
To free up storage space from unnecessary images, such as those with deleted manifests, you must enable the garbage collector on your container registry. With the garbage collector enabled, the registry will delete the image blobs that no longer have references to any manifests, reducing the storage previously occupied by the deleted blobs. The process for enabling the garbage collector differs depending on your container registry.
For more information, see "Resolving storage cleanup issues in the distribution registry".
To skip deleting the Operator catalog image while you are deleting Operator images, you must list the specific Operators under the Operator catalog image in the
DeleteImageSetConfiguration
file. This ensures that only the specified Operators are deleted, not the catalog image.If only the Operator catalog image is specified, all Operators within that catalog, as well as the catalog image itself, will be deleted.
oc-mirror plugin v2 does not delete Operator catalog images automatically because other Operators may still be deployed and depend on these images.
If you are certain that no Operators from a catalog remain in the registry or cluster, you can explicitly add the catalog image to
additionalImages
inDeleteImageSetConfiguration
to remove it.- Garbage collection behavior depends on the registry. Some registries do not automatically remove deleted images, requiring a system administrator to manually trigger garbage collection to free up space.
A known issue in the distribution registry prevents the garbage collector from freeing up storage as expected. This issue does not occur when you use Red Hat Quay.
Procedure
Choose the appropriate method to work around the known issue in the distribution registry:
To restart the container registry, run the following command:
podman restart <registry_container>
$ podman restart <registry_container>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To disable caching in the registry configuration, perform the following steps:
To disable the
blobdescriptor
cache, modify the/etc/docker/registry/config.yml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To apply the changes, restart the container registry by running the following command:
podman restart <registry_container>
$ podman restart <registry_container>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.6.2. Deleting images from a disconnected environment 复制链接链接已复制到粘贴板!
To delete images from a disconnected environment using the oc-mirror plugin v2, follow the procedure.
Prerequisites
- You have enabled garbage collection in your environment to delete images that no longer reference manifests.
Procedure
Create a
delete-image-set-config.yaml
file and include the following content:DeleteImageSetConfiguration
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1 1
- Specify the name of the OpenShift Container Platform channel to delete, for example
stable-4.15
. - 2 3
- Specify a version range of the images to delete within the channel, for example
4.15.0
for the minimum version and4.15.1
for the maximum version. To delete only one version’s images, use that version number for both theminVersion
andmaxVersion
fields. - 4
- Specify an Operator catalog image containing the Operators to delete, for example
registry.redhat.io/redhat/redhat-operator-index:v4.14
. The Operator catalog image will not get deleted. Its presence in the registry might be necessary for other Operators still remaining on the cluster. - 5
- Specify a specific Operator to delete, for example
aws-load-balancer-operator
. - 6 7
- Specify a version range of the images to delete for the Operator, for example
0.0.1
for the minimum version and0.0.2
for the maximum version.
Create a
delete-images.yaml
file by running the following command:oc mirror delete --config delete-image-set-config.yaml --workspace file://<previously_mirrored_work_folder> --v2 --generate docker://<remote_registry>
$ oc mirror delete --config delete-image-set-config.yaml --workspace file://<previously_mirrored_work_folder> --v2 --generate docker://<remote_registry>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <previously_mirrored_work_folder>
- Specifies the directory where images were previously mirrored to or stored during the mirroring process.
- <remote_registry>
Specifies the URL or address of the remote container registry from which images will be deleted.
ImportantWhen deleting images, specify the correct workspace directory. Modify or delete the cache directory only when starting mirroring from scratch, such as setting up a new cluster. Incorrect changes to the cache directory might disrupt further mirroring operations.
-
Go to the
<previously_mirrored_work_folder>/delete
directory that was created. -
Verify that the
delete-images.yaml
file has been generated. - Manually ensure that each image listed in the file is no longer needed by the cluster and can be safely removed from the registry.
After you generate the
delete-images
YAML file, delete the images from the remote registry by running the following command:oc mirror delete --v2 --delete-yaml-file <previously_mirrored_work_folder>/working-dir/delete/delete-images.yaml docker://<remote_registry>
$ oc mirror delete --v2 --delete-yaml-file <previously_mirrored_work_folder>/working-dir/delete/delete-images.yaml docker://<remote_registry>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <previously_mirrored_work_folder>
- Specifies the directory where images were previously mirrored or stored during the mirroring process.
- <remote_registry>
Specifies the URL or address of the remote container registry from which images will be deleted.
ImportantWhen using the mirror-to-mirror method to mirror images, images are not cached locally, so you cannot delete images from a local cache.
5.7. Verifying your selected images for mirroring 复制链接链接已复制到粘贴板!
You can use oc-mirror plugin v2 to perform a test run (dry run) that does not actually mirror any images. This enables you to review the list of images that would be mirrored. You can also use a dry run to catch any errors with your image set configuration early. When running a dry run on a mirror-to-disk workflow, the oc-mirror plugin v2 checks if all the images within the image set are available in its cache. Any missing images are listed in the missing.txt
file. When a dry run is performed before mirroring, both missing.txt
and mapping.txt
files contain the same list of images.
5.7.1. Performing a dry run for oc-mirror plugin v2 复制链接链接已复制到粘贴板!
Verify your image set configuration by performing a dry run without mirroring any images. This ensures your setup is correct and prevents unintended changes.
Procedure
To perform a test run, run the
oc mirror
command and append the--dry-run
argument to the command:oc mirror -c <image_set_config_yaml> file://<oc_mirror_workspace_path> --dry-run --v2
$ oc mirror -c <image_set_config_yaml> file://<oc_mirror_workspace_path> --dry-run --v2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<image_set_config_yaml>
- Specifies the image set configuration file that you created.
<oc_mirror_workspace_path>
- Insert the address of the workspace path.
<mirror_registry_url>
Insert the URL or address of the remote container registry from which images will be mirrored or deleted.
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Navigate to the workspace directory that was generated:
cd <oc_mirror_workspace_path>
$ cd <oc_mirror_workspace_path>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Review the
mapping.txt
andmissing.txt
files that were generated. These files contain a list of all images that would be mirrored.
5.7.2. Troubleshooting oc-mirror plugin v2 errors 复制链接链接已复制到粘贴板!
oc-mirror plugin v2 now logs all image mirroring errors in a separate file, making it easier to track and diagnose failures.
When errors occur while mirroring release or release component images, they are critical. This stops the mirroring process immediately.
Errors with mirroring Operators, Operator-related images, or additional images do not stop the mirroring process. Mirroring continues, and oc-mirror plugin v2 saves a file under the working-dir/logs
directory describing which Operator failed to mirror.
When an image fails to mirror, and that image is mirrored as part of one or more Operator bundles, oc-mirror plugin v2 notifies the user which Operators are incomplete, providing clarity on the Operator bundles affected by the error.
Procedure
Check for server-related issues:
Example error
[ERROR] : [Worker] error mirroring image localhost:55000/openshift/graph-image:latest error: copying image 1/4 from manifest list: trying to reuse blob sha256:edab65b863aead24e3ed77cea194b6562143049a9307cd48f86b542db9eecb6e at destination: pinging container registry localhost:5000: Get "https://localhost:5000/v2/": http: server gave HTTP response to HTTPS client
[ERROR] : [Worker] error mirroring image localhost:55000/openshift/graph-image:latest error: copying image 1/4 from manifest list: trying to reuse blob sha256:edab65b863aead24e3ed77cea194b6562143049a9307cd48f86b542db9eecb6e at destination: pinging container registry localhost:5000: Get "https://localhost:5000/v2/": http: server gave HTTP response to HTTPS client
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Open the
mirroring_error_date_time.log
file in theworking-dir/logs
folder located in the oc-mirror plugin v2 output directory. -
Look for error messages that typically indicate server-side issues, such as
HTTP 500
errors, expired tokens, or timeouts. - Retry the mirroring process or contact support if the issue persists.
-
Open the
Check for incomplete mirroring of Operators:
Example error
error mirroring image docker://registry.redhat.io/3scale-amp2/zync-rhel9@sha256:8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d (Operator bundles: [3scale-operator.v0.11.12] - Operators: [3scale-operator]) error: initializing source docker://localhost:55000/3scale-amp2/zync-rhel9:8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d: reading manifest 8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d in localhost:55000/3scale-amp2/zync-rhel9: manifest unknown error mirroring image docker://registry.redhat.io/3scale-amp2/3scale-rhel7-operator-metadata@sha256:de0a70d1263a6a596d28bf376158056631afd0b6159865008a7263a8e9bf0c7d error: skipping operator bundle docker://registry.redhat.io/3scale-amp2/3scale-rhel7-operator-metadata@sha256:de0a70d1263a6a596d28bf376158056631afd0b6159865008a7263a8e9bf0c7d because one of its related images failed to mirror error mirroring image docker://registry.redhat.io/3scale-amp2/system-rhel7@sha256:fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e (Operator bundles: [3scale-operator.v0.11.12] - Operators: [3scale-operator]) error: initializing source docker://localhost:55000/3scale-amp2/system-rhel7:fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e: reading manifest fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e in localhost:55000/3scale-amp2/system-rhel7: manifest unknown
error mirroring image docker://registry.redhat.io/3scale-amp2/zync-rhel9@sha256:8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d (Operator bundles: [3scale-operator.v0.11.12] - Operators: [3scale-operator]) error: initializing source docker://localhost:55000/3scale-amp2/zync-rhel9:8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d: reading manifest 8bb6b31e108d67476cc62622f20ff8db34efae5d58014de9502336fcc479d86d in localhost:55000/3scale-amp2/zync-rhel9: manifest unknown error mirroring image docker://registry.redhat.io/3scale-amp2/3scale-rhel7-operator-metadata@sha256:de0a70d1263a6a596d28bf376158056631afd0b6159865008a7263a8e9bf0c7d error: skipping operator bundle docker://registry.redhat.io/3scale-amp2/3scale-rhel7-operator-metadata@sha256:de0a70d1263a6a596d28bf376158056631afd0b6159865008a7263a8e9bf0c7d because one of its related images failed to mirror error mirroring image docker://registry.redhat.io/3scale-amp2/system-rhel7@sha256:fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e (Operator bundles: [3scale-operator.v0.11.12] - Operators: [3scale-operator]) error: initializing source docker://localhost:55000/3scale-amp2/system-rhel7:fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e: reading manifest fe77272021867cc6b6d5d0c9bd06c99d4024ad53f1ab94ec0ab69d0fda74588e in localhost:55000/3scale-amp2/system-rhel7: manifest unknown
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check for warnings in the console or log file indicating which Operators are incomplete.
If an Operator is flagged as incomplete, the image related to that Operator likely failed to mirror.
- Manually mirror the missing image or retry the mirroring process.
Check for errors related to generated cluster resources. Even if some images fail to mirror, oc-mirror v2 will still generate cluster resources such as
IDMS.yaml
andITMS.yaml
files for the successfully mirrored images.- Check the output directory for the generated files.
- If these files are missing for specific images, ensure that no critical errors occurred for those images during the mirroring process.
By following these steps, you can better diagnose issues and ensure smoother mirroring.
5.8. Benefits of enclave support 复制链接链接已复制到粘贴板!
Enclave support restricts internal access to a specific part of a network. Unlike a demilitarized zone (DMZ) network, which allows inbound and outbound traffic access through firewall boundaries, enclaves do not cross firewall boundaries.
The new enclave support functionality is for scenarios where mirroring is needed for multiple enclaves that are secured behind at least one intermediate disconnected network.
Enclave support has the following benefits:
- You can mirror content for multiple enclaves and centralize it in a single internal registry. Because some customers want to run security checks on the mirrored content, with this setup they can run these checks all at once. The content is then vetted before being mirrored to downstream enclaves.
- You can mirror content directly from the centralized internal registry to enclaves without restarting the mirroring process from the internet for each enclave.
- You can minimize data transfer between network stages, so to ensure that a blob or image is transferred only once from one stage to another.
5.8.1. Enclave mirroring workflow 复制链接链接已复制到粘贴板!
The previous image outlines the flow for using the oc-mirror plugin in different environments, including environments with and without an internet connection.
Environment with Internet Connection:
- The user executes oc-mirror plugin v2 to mirror content from an online registry to a local disk directory.
- The mirrored content is saved to the disk for transfer to offline environments.
Disconnected Enterprise Environment (No Internet):
Flow 1:
-
The user runs oc-mirror plugin v2 to load the mirrored content from the disk directory, which was transferred from the online environment, into the
enterprise-registry.in
registry.
-
The user runs oc-mirror plugin v2 to load the mirrored content from the disk directory, which was transferred from the online environment, into the
Flow 2:
-
After updating the
registries.conf
file, the user executes the oc-mirror plugin v2 to mirror content from theenterprise-registry.in
registry to an enclave environment. - The content is saved to a disk directory for transfer to the enclave.
-
After updating the
Enclave Environment (No Internet):
-
The user runs oc-mirror plugin v2 to load content from the disk directory into the
enclave-registry.in
registry.
The image visually represents the data flow across these environments and emphasizes the use of oc-mirror to handle disconnected and enclave environments without an internet connection.
5.8.2. Mirroring to an enclave 复制链接链接已复制到粘贴板!
When you mirror to an enclave, you must first transfer the necessary images from one or more enclaves into the enterprise central registry.
The central registry is situated within a secure network, specifically a disconnected environment, and is not directly linked to the public internet. But the user must execute oc mirror
in an environment with access to the public internet.
Procedure
Before running oc-mirror plugin v2 in the disconnected environment, create a
registries.conf
file. The TOML format of the file is described in this specification:NoteIt is recommended to store the file under
$HOME/.config/containers/registries.conf
or/etc/containers/registries.conf
.Example
registries.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate a mirror archive.
To collect all the OpenShift Container Platform content into an archive on the disk under
<file_path>/enterprise-content
, run the following command:oc mirror --v2 -c isc.yaml file://<file_path>/enterprise-content
$ oc mirror --v2 -c isc.yaml file://<file_path>/enterprise-content
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example of isc.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After the archive is generated, it is transferred to the disconnected environment. The transport mechanism is not part of oc-mirror plugin v2. The enterprise network administrators determine the transfer strategy.
In some cases, the transfer is done manually, in that the disk is physically unplugged from one location, and plugged to another computer in the disconnected environment. In other cases, the Secure File Transfer Protocol (SFTP) or other protocols are used.
After the transfer of the archive is done, you can execute oc-mirror plugin v2 again in order to mirror the relevant archive contents to the registry (
entrerpise_registry.in
in the example) as demonstrated in the following example:oc mirror --v2 -c isc.yaml --from file://<disconnected_environment_file_path>/enterprise-content docker://<enterprise_registry.in>/
$ oc mirror --v2 -c isc.yaml --from file://<disconnected_environment_file_path>/enterprise-content docker://<enterprise_registry.in>/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where:
-
--from
points to the folder containing the archive. It starts with thefile://
. -
docker://
is the destination of the mirroring is the final argument. Because it is a docker registry. -
-c
(--config
) is a mandatory argument. It enables oc-mirror plugin v2 to eventually mirror only sub-parts of the archive to the registry. One archive might contain several OpenShift Container Platform releases, but the disconnected environment or an enclave might mirror only a few.
-
Prepare the
imageSetConfig
YAML file, which describes the content to mirror to the enclave:Example isc-enclave.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You must run oc-mirror plugin v2 on a machine with access to the disconnected registry. In the previous example, the disconnected environment,
enterprise-registry.in
, is accessible.Update the graph URL
If you are using
graph:true
, oc-mirror plugin v2 attempts to reach thecincinnati
API endpoint. Because this environment is disconnected, be sure to export the environment variableUPDATE_URL_OVERRIDE
to refer to the URL for the OpenShift Update Service (OSUS):export UPDATE_URL_OVERRIDE=https://<osus.enterprise.in>/graph
$ export UPDATE_URL_OVERRIDE=https://<osus.enterprise.in>/graph
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information on setting up OSUS on an OpenShift cluster, see "Updating a cluster in a disconnected environment using the OpenShift Update Service".
NoteWhen updating between OpenShift Container Platform Extended Update Support (EUS) versions, you must also include images for an intermediate minor version between the current and target versions. The oc-mirror plugin v2 might not always detect this requirement automatically, so check the Red Hat OpenShift Container Platform Update Graph page to confirm any required intermediate versions.
Use the Update Graph page to find the intermediate minor versions suggested by the application, and include any of these versions in the
ImageSetConfiguration
file when using the oc-mirror plugin v2.Generate a mirror archive from the enterprise registry for the enclave.
To prepare an archive for the
enclave1
, the user executes oc-mirror plugin v2 in the enterprise disconnected environment by using theimageSetConfiguration
specific for that enclave. This ensures that only images needed by that enclave are mirrored:oc mirror --v2 -c isc-enclave.yaml
$ oc mirror --v2 -c isc-enclave.yaml file:///disk-enc1/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This action collects all the OpenShift Container Platform content into an archive and generates an archive on disk.
-
After the archive is generated, it will be transferred to the
enclave1
network. The transport mechanism is not the responsibility of oc-mirror plugin v2. Mirror contents to the enclave registry
After the transfer of the archive is done, the user can execute oc-mirror plugin v2 again in order to mirror the relevant archive contents to the registry.
oc mirror --v2 -c isc-enclave.yaml --from file://local-disk docker://registry.enc1.in
$ oc mirror --v2 -c isc-enclave.yaml --from file://local-disk docker://registry.enc1.in
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The administrators of the OpenShift Container Platform cluster in
enclave1
are now ready to install or upgrade that cluster.
5.9. oc-mirror plugin v2 support proxy setting 复制链接链接已复制到粘贴板!
The oc-mirror plugin v2 can operate in a proxy-configured environment. The plugin can use system proxy settings to retrieve images for OpenShift Container Platform, Operator catalog, and the additionalImages
registry.
5.10. How filtering works in the operator catalog 复制链接链接已复制到粘贴板!
oc-mirror plugin v2 selects the list of bundles for mirroring by processing the information in imageSetConfig
.
When oc-mirror plugin v2 selects bundles for mirroring, it does not infer Group Version Kind (GVK) or bundle dependencies, omitting them from the mirroring set. Instead, it strictly adheres to the user instructions. You must explicitly specify any required dependent packages and their versions.
ImageSetConfig operator filtering | Expected bundle versions |
---|---|
Scenario 1 mirror: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
| For each package in the catalog, one bundle, corresponding to the head version for each channel of that package. |
Scenario 2 mirror: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10 full: true
| All bundles of all channels of the specified catalog. |
Scenario 3 mirror: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10 packages: - name: compliance-operator
| One bundle, corresponding to the head version for each channel of that package. |
Scenario 4 | All bundles of all channels for the packages specified. |
Scenario 5 |
All bundles in all channels, from the |
Scenario 6 |
All bundles in all channels that are lower than the |
Scenario 7 |
All bundles in all channels, between the |
Scenario 8 |
The head bundle for the selected channel of that package. You must use the |
Scenario 9 |
All bundles for the packages and channels specified. The |
Scenario 10 | The head bundle for each selected channel of that package. |
Scenario 11 |
Within the selected channel of that package, all versions starting with the |
Scenario 12 |
Within the selected channel of that package, all versions up to |
Scenario 13 |
Within the selected channel of that package, all versions between the |
Scenario 14 |
Do not use this scenario. filtering by channel and by package with a |
Scenario 15 |
Do not use this scenario. You cannot filter using |
Scenario 16 |
Do not use this scenario. You cannot filter using |
The oc-mirror plugin v2 requires an image set configuration file that defines what images to mirror. The following table lists the available parameters for the ImageSetConfiguration
resource.
Using the minVersion
and maxVersion
properties to filter for a specific Operator version range can result in a multiple channel heads error. The error message states that there are multiple channel heads
. This is because when the filter is applied, the update graph of the Operator is truncated.
OLM requires that every Operator channel contains versions that form an update graph with exactly one end point, that is, the latest version of the Operator. When the filter range is applied, that graph can turn into two or more separate graphs or a graph that has more than one end point.
To avoid this error, do not filter out the latest version of an Operator. If you still run into the error, depending on the Operator, either the maxVersion
property must be increased or the minVersion
property must be decreased. Because every Operator graph can be different, you might need to adjust these values until the error resolves.
Parameter | Description | Values |
---|---|---|
|
The API version of the |
String Example: |
| The maximum size, in GiB, of each archive file within the image set. |
Integer Example: |
|
When set to |
Boolean Example |
| The configuration of the image set. | Object |
| The additional images configuration of the image set. | Array of objects Example: additionalImages: - name: registry.redhat.io/ubi8/ubi:latest
|
| The tag or digest of the image to mirror. |
String Example: |
| List of images with a tag or digest (SHA) to block from mirroring. |
Array of strings Example: |
|
The helm configuration of the image set. The oc-mirror plugin does not support helm charts with manually modified | Object |
| The local helm charts to mirror. | Array of objects. For example: local: - name: podinfo path: /test/podinfo-5.0.0.tar.gz
|
| 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 custom path of a container image inside of the helm chart. + Note
|
Array of string. For example: |
| The Operators configuration of the image set. | Array of objects Example: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:4.18 packages: - name: elasticsearch-operator minVersion: '2.4.0'
|
| The Operator catalog to include in the image set. |
String Example: |
|
When |
Boolean The default value is |
| The Operator packages configuration. | Array of objects Example: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:4.18 packages: - name: elasticsearch-operator minVersion: '5.2.3-31'
|
| The Operator package name to include in the image set. |
String Example: |
| Operator package channel configuration | Object |
| The Operator channel name, unique within a package, to include in the image set. |
String Eample: |
| The highest version of the Operator mirror across all channels in which it exists. |
String Example: |
| The lowest version of the Operator to mirror across all channels in which it exists |
String Example: |
| The highest version of the Operator to mirror across all channels in which it exists. |
String Example: |
| The lowest version of the Operator to mirror across all channels in which it exists. |
String Example: |
| An alternative name and optional namespace hierarchy to mirror the referenced catalog as |
String Example: |
| Path on disk for a template to use to complete catalogSource custom resource generated by oc-mirror plugin v2. |
String Example: |
|
An alternative tag to append to the |
String Example: |
| The platform configuration of the image set. | Object |
| The architecture of the platform release payload to mirror. | Array of strings Example:
The default value is |
| The platform channel configuration of the image set. | Array of objects Example: channels: - name: stable-4.12 - name: stable-4.18
|
|
When |
Boolean The default value is |
| Name of the release channel |
String Example: |
| The minimum version of the referenced platform to be mirrored. |
String Example: |
| The highest version of the referenced platform to be mirrored. |
String Example: |
| Toggles shortest path mirroring or full range mirroring. |
Boolean The default value is |
| Type of the platform to be mirrored |
String Example: |
| Indicates whether the OSUS graph is added to the image set and subsequently published to the mirror. |
Boolean The default value is |
| Must be defined when excluding the default channel from the filtering. | Array of objects. For example: |
5.11.1. DeleteImageSetConfiguration parameters 复制链接链接已复制到粘贴板!
To use remove images with the oc-mirror plugin v2, you must use a DeleteImageSetConfiguration.yaml
configuration file that defines which images to delete from the mirror registry. The following table lists the available parameters for the DeleteImageSetConfiguration
resource.
Parameter | Description | Values |
---|---|---|
|
The API version for the |
String Example: |
| The configuration of the image set to delete. | Object |
| The additional images configuration of the delete image set. | Array of objects Example: additionalImages: - name: registry.redhat.io/ubi8/ubi:latest
|
| The tag or digest of the image to delete. |
String Example: |
| The Operators configuration of the delete image set. | Array of objects Example: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:{product-version} packages: - name: elasticsearch-operator minVersion: '2.4.0'
|
| The Operator catalog to include in the delete image set. |
String Example: |
| When true, deletes the full catalog, Operator package, or Operator channel. |
Boolean The default value is |
| Operator packages configuration | Array of objects Example: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:{product-version} packages: - name: elasticsearch-operator minVersion: '5.2.3-31'
|
| The Operator package name to include in the delete image set. |
String Example: |
| Operator package channel configuration | Object |
| The Operator channel name, unique within a package, to include in the delete image set. |
String Example: |
| The highest version of the Operator to delete within the selected channel. |
String Example: |
| The lowest version of the Operator to delete within the selection in which it exists. |
String Example: |
| The highest version of the Operator to delete across all channels in which it exists. |
String Example: |
| The lowest version of the Operator to delete across all channels in which it exists. |
String Example: |
| The platform configuration of the image set | Object |
| The architecture of the platform release payload to delete. | Array of strings Example:
The default value is |
| The platform channel configuration of the image set. | Array of objects Example: channels: - name: stable-4.12 - name: stable-4.18
|
|
When |
Boolean The default value is |
| Name of the release channel |
String Example: |
| The minimum version of the referenced platform to be deleted. |
String Example: |
| The highest version of the referenced platform to be deleted. |
String Example: |
| Toggles between deleting the shortest path and deleting the full range. |
Boolean The default value is |
| Type of the platform to be deleted |
String Example: |
| Determines whether the OSUS graph is deleted as well on the mirror registry as well. |
Boolean The default value is |
5.12. Command reference for oc-mirror plugin v2 复制链接链接已复制到粘贴板!
The following tables describe the oc mirror
subcommands and flags for oc-mirror plugin v2:
Subcommand | Description |
---|---|
| Show help about any subcommand |
| Output the oc-mirror version |
| Deletes images in remote registry and local cache. |
Flag | Description |
---|---|
|
Displays the string path of the authentication file. Default is |
| Specifies the path to an image set configuration file. |
|
oc-mirror cache directory location. The default value is |
|
Requires HTTPS and verifies certificates when accessing the container registry or daemon. The default value is |
| Prints actions without mirroring images. |
| Specifies the path to an image set archive that was generated by executing oc-mirror plugin v2 to load a target registry. |
| Displays help |
|
Timeout for mirroring an image. The default is 10m0s. Valid time units are |
|
Displays string log levels. Supported values include info, debug, trace, error. The default value is |
|
Determines the HTTP port used by oc-mirror plugin v2 local storage instance. The default value is |
|
Specifies the number of images mirrored in parallel. The default value is |
|
Specifies the number of image layers mirrored in parallel. The default value is |
|
Specifies the maximum number of nested paths for destination registries that limit nested paths. The default value is |
|
The default value is |
|
Includes all new content since a specified date (format: |
| Requires HTTPS and verifies certificates when accessing the container registry or daemon. |
|
The default value is |
| Displays the version for oc-mirror plugin v2. |
| Determines string oc-mirror plugin v2 workspace where resources and internal artifacts are generated. |
|
Delay between 2 retries. The default value is |
|
The number of times to retry. The default value is |
|
Overrides the default container rootless storage path (usually in |
5.12.1. Command reference for deleting images 复制链接链接已复制到粘贴板!
The following tables describe the oc mirror
subcommands and flags for deleting images:
Subcommand | Description |
---|---|
|
Path of the authentication file. The default value is |
|
oc-mirror cache directory location. The default is |
| Path to the delete imageset configuration file. |
| Used to differentiate between versions for files created by the delete functionality. |
|
Used during the migration, along with |
| If set, uses the generated or updated yaml file to delete contents. |
|
Require HTTPS and verify certificates when talking to the container registry or daemon. The default value is |
| Used to force delete the local cache manifests and blobs. |
| Used to generate the delete yaml for the list of manifests and blobs, used when deleting from local cache and remote registry. |
| Displays help. |
|
Log level one of |
|
Indicates the number of images deleted in parallel. The default value is |
|
Indicates the number of image layers mirrored in parallel. The default value is |
|
HTTP port used by oc-mirror’s local storage instance. The default value is |
|
Duration delay between 2 retries. The default value is |
|
The number of times to retry. The default value is |
|
Require HTTPS and verify certificates when talking to the container registry or daemon. The default value is |
| oc-mirror workspace where resources and internal artifacts are generated. |
5.13. Next steps 复制链接链接已复制到粘贴板!
After you mirror images to your disconnected environment using oc-mirror plugin v2, you can perform any of the following actions: