9.4. Adding OLM-based Operators to a disconnected cluster
You can use OLM-based Operators in disconnected situations by embedding them in a Red Hat Enterprise Linux for Edge (RHEL for Edge) image.
For Operators that are installed on disconnected clusters, Operator Lifecycle Manager (OLM) by default cannot access sources hosted on remote registries because those remote sources require full internet connectivity. Therefore, you must mirror the remote registries to a highly available container registry.
The following steps are required to use OLM-based Operators in disconnected situations:
- Include OLM in the container image list for your mirror registry.
-
Configure the system to use your mirror registry by updating your CRI-O configuration directly.
ImageContentSourcePolicyis not supported in MicroShift. -
Add a
CatalogSourceobject to the cluster so that the OLM catalog Operator can use the local catalog on the mirror registry. - Ensure that MicroShift is installed to run in a disconnected capacity.
- Ensure that the network settings are configured to run in disconnected mode.
After enabling OLM in a disconnected cluster, you can continue to use your internet-connected workstation to keep your local catalog sources updated as newer versions of Operators are released.
9.4.1.1. Performing a dry run 复制链接链接已复制到粘贴板!
You can use oc-mirror to perform a dry run, without actually mirroring any images. A dry run means you can review the list of images to be mirrored. You can catch any errors with your image set configuration early by using a dry run, or use the generated list of images with other tools to conduct mirroring.
Prerequisites
- You have access to the internet to obtain the necessary container images.
-
You installed the OpenShift CLI (
oc). - You installed the oc-mirror CLI plugin.
- You created the image set configuration file.
Procedure
Run the
oc mirrorcommand with the--dry-runflag to perform a dry run:$ oc-mirror --config <ImageSetConfig.yaml> docker://localhost:5000 --workspace file://<outm2m> --dry-run --v2where:
ImageSetConfig.yaml- Specifies the name of the image set configuration file that you created.
docker://localhost:5000-
Specifies the mirror registry. Nothing is mirrored to this registry when you use the
--dry-runflag. --workspace file://<outm2m>- Insert the address of the workspace path.
--dry-run- The dry run flag generates the dry run artifacts and not an actual image set file.
--v2Specifies oc mirror v2.
Example output
2025/08/25 15:50:44 [INFO] : 👋 Hello, welcome to oc-mirror 2025/08/25 15:50:44 [INFO] : ⚙ setting up the environment for you... 2025/08/25 15:50:44 [INFO] : 🔀 workflow mode: mirrorToMirror 2025/08/25 15:50:44 [INFO] : 🕵 going to discover the necessary images... 2025/08/25 15:50:44 [INFO] : 🔍 collecting release images... 2025/08/25 15:50:44 [INFO] : 🔍 collecting operator images... ✓ (1m30s) Collecting catalog registry.redhat.io/redhat/redhat-operator-index:v4.20 2025/08/25 15:52:14 [INFO] : 🔍 collecting additional images... 2025/08/25 15:52:14 [INFO] : 📄 list of all images for mirroring in : wspace/working-dir/dry-run/mapping.txt 2025/08/25 15:52:14 [INFO] : mirror time : 1m30.399585837s 2025/08/25 15:52:14 [INFO] : 👋 Goodbye, thank you for using oc-mirror
Review the
mapping.txtfile that was generated by running the following command:$ cat wspace/working-dir/dry-run/mapping.txtExample output
docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:47fd4ce2533496828aba37bd1f9715e2164d5c90bd0fc6b25e7e0786d723bf01=docker://mirror.com/amq8/amq-broker-rhel9:sha256-47fd4ce2533496828aba37bd1f9715e2164d5c90bd0fc6b25e7e0786d723bf01 docker://registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:9cc48eecf1442ae04b8543fa5d4381a13bc2831390850828834d387006d1342b=docker://mirror.com/amq7/amq-broker-init-rhel9:sha256-9cc48eecf1442ae04b8543fa5d4381a13bc2831390850828834d387006d1342b docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:bb6fbd68475a7852b4d99eea6c4ab313f9267da7963162f0d75375d7063409e7=docker://mirror.com/amq8/amq-broker-rhel9:sha256-bb6fbd68475a7852b4d99eea6c4ab313f9267da7963162f0d75375d7063409e7 docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:d42d713da0ce6806fdc6492b6342586783e6865a82a8647d3c4288439b1751ee=docker://mirror.com/amq8/amq-broker-rhel9:sha256-d42d713da0ce6806fdc6492b6342586783e6865a82a8647d3c4288439b1751ee docker://registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:ffffa9875f0379e9373f89f05eb06e5a193273bb04bc3aa5f85b044357b79098=docker://mirror.com/amq8/amq-broker-init-rhel9:sha256-ffffa9875f0379e9373f89f05eb06e5a193273bb04bc3aa5f85b044357b79098
After performing a dry run with the oc-mirror plugin to review the list of images that you want to mirror, you must get all of the container image references, then format the output for adding to an image builder blueprint.
For catalogs made for proprietary Operators, you can format image references for the image builder blueprint without using the following procedure.
Prerequisites
- You have a catalog index for the Operators you want to use.
-
You have installed the
jqCLI tool. - You are familiar with image builder blueprint files.
- You have an image builder blueprint TOML file.
Procedure
Parse the catalog
index.jsonfile to get the image references that you need to include in the image builder blueprint. You can use either the unfiltered catalog or you can filter out images that cannot be mirrored:Parse the unfiltered catalog
index.jsonfile to get the image references by running the following command:jq -r --slurp '.[] | select(.relatedImages != null) | "[[containers]]\nsource = \"" + .relatedImages[].image + "\"\n"' ./oc-mirror-workspace/src/catalogs/registry.redhat.io/redhat/redhat-operator-index/v4.18/index/index.jsonIf you want to filter out images that cannot be mirrored, filter and parse the catalog
index.jsonfile by running the following command:$ jq -r --slurp '.[] | select(.relatedImages != null) | .relatedImages[] | select(.name | contains("ppc") or contains("s390x") | not) | "[[containers]]\\nsource = \\"" + .image + "\\"\\n"' ./oc-mirror-workspace/src/catalogs/registry.redhat.io/redhat/redhat-operator-index/v4.18/index/index.json注意This step uses the AMQ Broker Operator as an example. You can add other criteria to the
jqcommand for further filtering as required by your use case.Example image-reference output
[[containers]] source = "registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:0b2126cfb6054fdf428c1f43b69e36e93a09a49ce15350e9273c98cc08c6598b" [[containers]] source = "registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:0dde839c2dce7cb684094bf26523c8e16677de03149a0fff468b8c3f106e1f4f" ... ... [[containers]] source = "registry.redhat.io/amq8/amq-broker-rhel9@sha256:e8fa2a00e576ecb95561ffbdbf87b1c82d479c8791ab2c6ce741dd0d0b496d15" [[containers]] source = "registry.redhat.io/amq8/amq-broker-rhel9@sha256:ff6fefad518a6c997d4c5a6e475ba89640260167f0bc27715daf3cc30116fad1" … EOF重要For mirrored and disconnected use cases, ensure that all of the sources filtered from your catalog
index.jsonfile are digests. If any of the sources use tags instead of digests, the Operator installation fails. Tags require an internet connection.
View the
imageset-config.yamlto get the catalog image reference for theCatalogSourcecustom resource (CR) by running the following command:$ cat imageset-config.yamlExample output
kind: ImageSetConfiguration apiVersion: mirror.openshift.io/v2alpha1 mirror: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.181 packages: - name: amq-broker-rhel9 channels: - name: 7.13.x- 1
- Use the value in the
mirror.catalogcatalog image reference for the followingjqcommand to get the image digest. In this example, <registry.redhat.io/redhat/redhat-operator-index:v4.18>.
Get the SHA of the catalog index image by running the following command:
$ skopeo inspect docker://<registry.redhat.io/redhat/redhat-operator-index:v{product-version}> | jq .Digest1 - 1
- Use the value in the
mirror.catalogcatalog image reference for thejqcommand to get the image digest. In this example, <registry.redhat.io/redhat/redhat-operator-index:v4.18>.
Example output
"sha256:7a76c0880a839035eb6e896d54ebd63668bb37b82040692141ba39ab4c539bc6"To get ready to add the image references to your image builder blueprint file, format the catalog image reference by using the following example:
[[containers]] source = "registry.redhat.io/redhat/redhat-operator-index@sha256:7a76c0880a839035eb6e896d54ebd63668bb37b82040692141ba39ab4c539bc6"Add the image references from all of the previous steps to the image builder blueprint.
Generated image builder blueprint example snippet
name = "microshift_blueprint" description = "MicroShift 4.18.1 on x86_64 platform" version = "0.0.1" modules = [] groups = [] [[packages]]1 name = "microshift" version = "4.18.1" ... ... [customizations.services]2 enabled = ["microshift"] [customizations.firewall] ports = ["22:tcp", "80:tcp", "443:tcp", "5353:udp", "6443:tcp", "30000-32767:tcp", "30000-32767:udp"] ... ... [[containers]]3 source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:f41e79c17e8b41f1b0a5a32c3e2dd7cd15b8274554d3f1ba12b2598a347475f4" [[containers]] source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:dbc65f1fba7d92b36cf7514cd130fe83a9bd211005ddb23a8dc479e0eea645fd" ... ... [[containers]]4 source = "registry.redhat.io/redhat/redhat-operator-index@sha256:7a76c0880a839035eb6e896d54ebd63668bb37b82040692141ba39ab4c539bc6" ... ... [[containers]] source = "registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:0dde839c2dce7cb684094bf26523c8e16677de03149a0fff468b8c3f106e1f4f" ... ... [[containers]] source = "registry.redhat.io/amq8/amq-broker-rhel9@sha256:e8fa2a00e576ecb95561ffbdbf87b1c82d479c8791ab2c6ce741dd0d0b496d15" [[containers]] source = "registry.redhat.io/amq8/amq-broker-rhel9@sha256:ff6fefad518a6c997d4c5a6e475ba89640260167f0bc27715daf3cc30116fad1" … EOF- 1
- References for all non-optional MicroShift RPM packages using the same version compatible with the
microshift-release-infoRPM. - 2
- References for automatically enabling MicroShift on system startup and applying default networking settings.
- 3
- References for all non-optional MicroShift container images necessary for a disconnected deployment.
- 4
- References for the catalog index.
After you have created a RHEL for Edge image for a disconnected environment and configured MicroShift networking settings for disconnected use, you can configure the namespace and create catalog and Operator custom resources (CR) for running your Operators.
Prerequisites
- You have a RHEL for Edge image.
- Networking is configured for disconnected use.
- You completed the oc-mirror plugin dry run procedure.
Procedure
Create a
CatalogSourcecustom resource (CR), similar to the following example:Example
my-catalog-source-cr.yamlfileapiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: cs-redhat-operator-index namespace: openshift-marketplace1 spec: image: registry.example.com/redhat/redhat-operator-index:v4.17 sourceType: grpc displayName: publisher: updateStrategy: registryPoll: interval: 60m- 1
- The global namespace. Setting the
metadata.namespacetoopenshift-marketplaceenables the catalog to run in all namespaces. Subscriptions in any namespace can reference catalogs created in theopenshift-marketplacenamespace.
注意The default pod security admission definition for
openshift-marketplaceisbaseline, therefore a catalog source custom resource (CR) created in that namespace does not require aspec.grpcPodConfig.securityContextConfigvalue to be set. You can set alegacyorrestrictedvalue if required for the namespace and Operators you want to use.Add the SHA of the catalog index commit to the Catalog Source (CR), similar to the following example:
Example namespace
spec.imageconfigurationapiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: cs-redhat-operator-index namespace: openshift-marketplace spec: image: registry.example.com/redhat/redhat-operator-index@sha256:7a76c0880a839035eb6e896d54ebd63668bb37b82040692141ba39ab4c539bc61 sourceType: grpc displayName: publisher: updateStrategy: registryPoll: interval: 60m- 1
- The SHA of the image commit. Use the same SHA you added to the image builder blueprint.
重要You must use the SHA instead of a tag in your catalog CR or the pod fails to start.
Apply the YAML file from the oc-mirror plugin dry run results directory to the cluster by running the following command:
$ oc apply -f ./oc-mirror-workspace/results-1708508014/catalogSource-cs-redhat-operator-index.yamlExample output
catalogsource.operators.coreos.com/cs-redhat-operator-index createdVerify that the
CatalogSourceresources were successfully installed by running the following command:$ oc get catalogsource --all-namespacesVerify that the catalog source is running by using the following command:
$ oc get pods -n openshift-marketplaceExample output
NAME READY STATUS RESTARTS AGE cs-redhat-operator-index-4227b 2/2 Running 0 2m5sCreate a
SubscriptionCR, similar to the following example:Example
my-subscription-cr.yamlfileapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: amq-broker namespace: openshift-operators spec: channel: 7.11.x name: amq-broker-rhel8 source: cs-redhat-operator-index sourceNamespace: openshift-marketplaceApply the
SubscriptionCR by running the following command:$ oc apply -f ./<my-subscription-cr.yaml>1 - 1
- Specify the name of your
SubscriptionCR, such asmy-subscription-cr.yaml.
Example output
subscription.operators.coreos.com/amq-broker created