Running OpenShift in a disconnected (air-gapped) environment is not a one-shot installation exercise. It is a long-term supply-chain commitment: every release payload, every operator bundle, every sidecar image your workloads pull must exist in a registry you own, with the right digests, the right signatures, and the right cluster-side mirror configuration. Get the initial mirror wrong and the install fails fast — annoying but obvious. Get the maintenance model wrong and you discover it six months later, when oc adm upgrade tells you there is no update path, or when an OLM subscription silently stops resolving because the catalog you mirrored no longer contains the channel head.
This article walks through a production-grade mirroring workflow with oc-mirror: designing the ImageSetConfiguration, running the mirror-to-disk / disk-to-mirror flows, applying ImageDigestMirrorSet and CatalogSource objects, and — the part most teams underestimate — keeping the mirror consistent across cluster upgrades.
The air-gap problem in practice
A connected cluster resolves quay.io/openshift-release-dev/ocp-release@sha256:... directly. In a disconnected cluster, three independent things must line up:
-
The bytes exist in your registry, addressed by the same digest as upstream. Digests are the contract:
ImageDigestMirrorSetrewrites the registry host, never the digest. -
The cluster knows where to look — via
ImageDigestMirrorSet(IDMS) andImageTagMirrorSet(ITMS), rendered by the Machine Config Operator into/etc/containers/registries.confon every node. - The cluster trusts the content — your mirror registry CA must be in the cluster-wide additional trusted CA bundle, and release payloads must have a matching signature ConfigMap for the Cluster Version Operator to accept an upgrade target.
Miss #3 and everything looks fine until upgrade time, when the CVO refuses the target with Unable to verify sha256:... against keyrings.
A fourth, non-technical failure mode dominates real incidents: the mirror becomes a snapshot of whatever someone synced on day one. Six months later the catalog index is stale, the operators pinned in it have been pruned upstream, and nobody can reproduce the original sync because the ImageSetConfiguration was never committed to Git.
Building the mirror foundation
Registry choice and sizing
Quay (either Red Hat Quay or the lightweight mirror-registry installer) is the pragmatic default: it supports digest-addressed pulls, robot accounts, organizations, and Clair scanning. Harbor and Artifactory work as well, provided they support OCI manifests and manifest lists.
For a lab or a single-purpose bastion, mirror-registry is enough:
# Installs a Podman-based Quay + Postgres on the bastion
./mirror-registry install \
--quayHostname mirror.example.com \
--quayRoot /opt/quay \
--quayStorage /opt/quay/storage \
--initUser mirroradmin
# Trust the generated CA locally
sudo cp /opt/quay/quay-rootCA/rootCA.pem /etc/pki/ca-trust/source/anchors/mirror-ca.crt
sudo update-ca-trust extract
Sizing is where people get burned. A single OpenShift minor channel window of 3–4 releases is roughly 100–200 GB. A full redhat-operator-index mirror is well over a terabyte and growing. You will filter packages — this is not optional.
Credentials and trust
oc-mirror reads the merged container auth file, in order: ${XDG_RUNTIME_DIR}/containers/auth.json, then ~/.docker/config.json.
# Connected host: authenticate against Red Hat registries
podman login --authfile ~/.docker/config.json registry.redhat.io
podman login --authfile ~/.docker/config.json registry.connect.redhat.com
podman login --authfile ~/.docker/config.json quay.io
# Disconnected host: authenticate against the mirror only
podman login --authfile ~/.docker/config.json \
--tls-verify=true mirror.example.com:8443
Never bake the Red Hat pull secret into the disconnected side. The two hosts have different credential scopes, and that separation is a security control, not an inconvenience.
Writing an ImageSetConfiguration that won't explode
oc-mirror v2 (--v2, GA since OpenShift 4.18 and available from 4.16) uses apiVersion: mirror.openshift.io/v2alpha1. It drops the v1 metadata image stored in the registry — the single worst design point of v1, where a corrupted metadata image made the whole mirror un-resumable. In v2, the local workspace cache is the source of truth.
Platform: pin a window, not a channel
apiVersion: mirror.openshift.io/v2alpha1
kind: ImageSetConfiguration
mirror:
platform:
# Build and push the Cincinnati graph-data image for OSUS
graph: true
channels:
- name: stable-4.16
type: ocp
minVersion: 4.16.20
maxVersion: 4.16.30
shortestPath: true
# Keep the next minor's entry point available for the upgrade
- name: stable-4.17
type: ocp
minVersion: 4.17.9
maxVersion: 4.17.9
Key points:
-
minVersion/maxVersionbound the payload set. Without them you mirror an entire channel history. -
shortestPath: truemirrors only the releases on the shortest upgrade path between the bounds, instead of every intermediate z-stream. - Always keep the version you are currently running in the config. If you drop it, a node that reboots and needs to re-pull the payload has nowhere to go, and rollback becomes impossible.
-
graph: truemakesoc-mirrorbuild theopenshift/graph-imageused by the OpenShift Update Service. You need it for a self-service upgrade graph inside the air gap.
Operators: filter, filter, filter
operators:
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.16
packages:
- name: cluster-logging
channels:
- name: stable-6.0
minVersion: 6.0.3
- name: local-storage-operator
defaultChannel: stable
- name: kubernetes-nmstate-operator
# Drop deprecated bundles that would bloat the index
full: false
- catalog: registry.redhat.io/redhat/certified-operator-index:v4.16
packages:
- name: gpu-operator-certified
channels:
- name: v24.9
Inspect a catalog before mirroring. With v2 the dependable tool is opm:
opm render registry.redhat.io/redhat/redhat-operator-index:v4.16 \
| jq -r 'select(.schema=="olm.channel" and .package=="cluster-logging")
| "\(.name)\t\(.entries[-1].name)"'
Two traps specific to operators:
-
Channel heads move. If you pin
minVersionwithout amaxVersion, each re-sync pulls whatever is now the head. That is usually what you want, but it means your mirror content changes even though your config file did not. Record the resolved bundle versions from theoc-mirroroutput in your change ticket. -
Catalog image tag vs digest.
oc-mirrorv2 rebuilds a filtered catalog and pushes it to your registry; the generatedCatalogSourcepoints at a digest. Do not hand-edit it to a floating tag unless you also create anImageTagMirrorSet.
Additional images and Helm charts
additionalImages:
- name: registry.redhat.io/ubi9/ubi:9.5
- name: registry.redhat.io/rhel9/support-tools:latest
- name: ghcr.io/stakater/reloader:v1.2.0
helm:
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
charts:
- name: redis
version: 20.6.1
Everything your workloads pull — builder images, init containers, debug tools, third-party charts — belongs here. The most common post-install incident in air-gapped clusters is an ImagePullBackOff on a must-gather or support-tools image nobody thought to mirror.
Running the mirror: the three flows
# 1. Mirror to disk (connected host)
oc-mirror --config imageset-config.yaml \
file:///data/mirror --v2
# Transfer /data/mirror across the air gap (tar + checksum + physical media)
tar -C /data -cf mirror-2024w48.tar mirror
sha256sum mirror-2024w48.tar > mirror-2024w48.tar.sha256
# 2. Disk to mirror (disconnected host)
oc-mirror --config imageset-config.yaml \
--from file:///data/mirror \
docker://mirror.example.com:8443 --v2
# 3. Or, when both registries are reachable: mirror to mirror
oc-mirror --config imageset-config.yaml \
--workspace file:///data/mirror \
docker://mirror.example.com:8443 --v2
Useful flags in production runs: --retry-times 5, --image-timeout 20m, --parallel-images 4, --dest-tls-verify=false only if you truly have no CA (prefer fixing trust), and --log-level debug when a single bundle keeps failing.
After the disk-to-mirror step, the generated cluster manifests are under the workspace:
ls /data/mirror/working-dir/cluster-resources/
# idms-oc-mirror.yaml
# itms-oc-mirror.yaml
# cs-redhat-operator-index-v4-16.yaml
# updateService.yaml
# signature-configmap.yaml
Commit these to Git alongside the ImageSetConfiguration. They are the audit trail of what the cluster is allowed to pull.
Applying the cluster resources
IDMS and ITMS
ImageContentSourcePolicy is deprecated since 4.13. Use ImageDigestMirrorSet:
apiVersion: config.openshift.io/v1
kind: ImageDigestMirrorSet
metadata:
name: idms-oc-mirror
spec:
imageDigestMirrors:
- source: quay.io/openshift-release-dev/ocp-release
mirrors:
- mirror.example.com:8443/openshift/release-images
mirrorSourcePolicy: NeverContactSource
- source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
mirrors:
- mirror.example.com:8443/openshift/release
mirrorSourcePolicy: NeverContactSource
- source: registry.redhat.io
mirrors:
- mirror.example.com:8443
mirrorSourcePolicy: NeverContactSource
mirrorSourcePolicy: NeverContactSource is the right setting for a strict air gap: it prevents CRI-O from wasting time (and generating firewall noise) trying to reach the unreachable upstream. Use AllowContactingSource only in "dark site with occasional egress" setups.
If you still have legacy ICSP objects:
oc adm migrate icsp icsp-1.yaml icsp-2.yaml --dest-dir ./idms-out
oc apply -f ./idms-out
oc delete imagecontentsourcepolicy --all
Applying IDMS/ITMS triggers a MachineConfigPool rollout. Watch it:
oc get mcp -w
oc debug node/<node> -- chroot /host cat /etc/containers/registries.conf
Trust the mirror CA cluster-wide (the key must be the registry host with .. replacing :):
oc create configmap registry-cas -n openshift-config \
--from-file=mirror.example.com..8443=/opt/quay/quay-rootCA/rootCA.pem
oc patch image.config.openshift.io/cluster --type=merge \
-p '{"spec":{"additionalTrustedCA":{"name":"registry-cas"}}}'
CatalogSource and OperatorHub
Disable the default catalogs first — in an air gap they will only produce CatalogSource pods in CrashLoopBackOff and noisy alerts:
oc patch OperatorHub cluster --type merge \
-p '{"spec":{"disableAllDefaultSources":true}}'
Then apply the generated source:
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: cs-redhat-operator-index-v4-16
namespace: openshift-marketplace
spec:
sourceType: grpc
image: mirror.example.com:8443/redhat/redhat-operator-index@sha256:9f0c...
displayName: Red Hat Operators (mirrored)
publisher: Platform Team
updateStrategy:
registryPoll:
interval: 30m
Validate:
oc get catalogsource -n openshift-marketplace
oc get packagemanifests -n openshift-marketplace | head
oc get packagemanifest cluster-logging -o jsonpath='{.status.channels[*].name}{"\n"}'
Surviving upgrades
Release signatures
The CVO verifies the release payload signature before applying an update. oc-mirror emits the signature ConfigMaps; they must land in openshift-config-managed with the right label:
oc apply -f /data/mirror/working-dir/cluster-resources/signature-configmap.yaml
oc get cm -n openshift-config-managed \
-l release.openshift.io/verification-signatures
Without them, a targeted upgrade fails verification, and the --force workaround you will be tempted to use disables a real supply-chain control.
The upgrade graph with OSUS
In a disconnected cluster, oc adm upgrade shows nothing because the cluster cannot reach api.openshift.com. Two options:
Option A — explicit digest upgrade. Simple, auditable, no extra operator:
oc adm upgrade --allow-explicit-upgrade \
--to-image mirror.example.com:8443/openshift/release-images@sha256:b7a1...
Option B — OpenShift Update Service (OSUS). Install the operator from your mirrored catalog, then:
apiVersion: updateservice.operator.openshift.io/v1
kind: UpdateService
metadata:
name: update-service-oc-mirror
namespace: openshift-update-service
spec:
replicas: 2
releases: mirror.example.com:8443/openshift/release-images
graphDataImage: mirror.example.com:8443/openshift/graph-image@sha256:3c4d...
POLICY_ENGINE=$(oc get -n openshift-update-service updateservice \
update-service-oc-mirror -o jsonpath='{.status.policyEngineURI}')
oc patch clusterversion version --type merge \
-p "{\"spec\":{\"upstream\":\"${POLICY_ENGINE}/api/upgrades_info/v1/graph\"}}"
oc adm upgrade
If the policy engine route uses a private CA, add that CA to the cluster-wide proxy trustedCA, otherwise the CVO cannot query the graph.
Incremental re-sync and pruning
Maintenance is a loop: bump the version window in Git, re-run the same two commands, apply the regenerated manifests. Because v2 keeps the workspace cache, incremental runs only transfer deltas.
Pruning is explicit and deliberately two-phase:
apiVersion: mirror.openshift.io/v2alpha1
kind: DeleteImageSetConfiguration
delete:
platform:
channels:
- name: stable-4.15
type: ocp
minVersion: 4.15.0
maxVersion: 4.15.30
# Phase 1: compute what would be deleted
oc-mirror delete --config delete-isc.yaml \
--workspace file:///data/mirror \
--generate docker://mirror.example.com:8443 --v2
# Review, then phase 2: execute
oc-mirror delete \
--delete-yaml-file /data/mirror/working-dir/delete/delete-images.yaml \
docker://mirror.example.com:8443 --v2
Then run registry garbage collection (Quay: the GC worker, or quay-app config FEATURE_GARBAGE_COLLECTION). Deleting manifests without GC reclaims nothing.
Never prune the running version. A hard rule: keep N (current), N-1 (rollback), and N+1 (target) on the mirror at all times.
Security best practices
- Treat the pull secret as a tier-0 credential. Store it in a vault, inject it at pipeline runtime, and keep it off the disconnected side entirely. Rotate it if a bastion is decommissioned.
-
Use Quay robot accounts with scoped permissions. The CI identity that pushes gets
writeon the mirror organizations; the cluster global pull secret gets a separateread-only robot. One compromised node must not be able to overwrite the release payload. -
Prefer real TLS over
--tls-verify=false. Issue the mirror certificate from your internal PKI, distribute the CA viaimage.config.openshift.io/clusteradditionalTrustedCA, and keep--dest-tls-verify=true. Disabling verification turns your air gap into an unauthenticated trust boundary. -
Keep signature verification on. Apply the generated signature ConfigMaps rather than
oc adm upgrade --force. For workload images, consider aClusterImagePolicy(sigstore verification, available from 4.17 as tech preview and maturing since) scoped to your mirror namespaces. -
Verify transfer integrity. Checksum the archive on both sides (
sha256sum -c), and ideally sign the checksum file with GPG. Removable media crossing an air gap is a classic injection point. -
Scan the mirror, not just the cluster. Enable Clair in Quay and gate promotion between a
stagingand aproductionorganization in the registry. A disconnected cluster cannot pull a fix quickly, so knowing your exposure matters more, not less. -
Version the configuration.
ImageSetConfiguration, generated IDMS/ITMS,CatalogSourceand the resolved digests go into Git, reviewed like any other change. Reproducibility is a security property. -
Restrict who can create IDMS/ITMS. Anyone with that permission can silently redirect
registry.redhat.ioto an attacker-controlled host. Limit it to the platform team through RBAC and admission policy.
Key takeaways
- Use
oc-mirror --v2: no fragile metadata image, a local workspace cache, and a realdeleteworkflow. - Bound your platform versions with
minVersion/maxVersionplusshortestPath, and always keep the currently running release in the mirror. - Filter operator catalogs aggressively by package and channel; a full index mirror is a terabyte-scale mistake.
-
ImageDigestMirrorSetwithmirrorSourcePolicy: NeverContactSourceis the correct air-gap posture;ImageContentSourcePolicyis deprecated — migrate withoc adm migrate icsp. - Upgrades need three things, not one: the payload images, the release signature ConfigMaps, and an upgrade graph (OSUS with
graph: true, or explicit--to-imageby digest). - Prune only with the two-phase
DeleteImageSetConfigurationflow, followed by registry garbage collection, and never below N-1. - Everything — config, generated manifests, resolved digests, checksums — lives in Git. A disconnected cluster you cannot rebuild from source control is not disconnected, it is stranded.
Top comments (0)