This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Chapter 12. Converting a connected cluster to a disconnected cluster
There might be some scenarios where you need to convert your OpenShift Container Platform cluster from a connected cluster to a disconnected cluster.
A disconnected cluster, also known as a restricted cluster, does not have an active connection to the internet. As such, you must mirror the contents of your registries and installation media. You can create this mirror registry on a host that can access both the internet and your closed network, or copy images to a device that you can move across network boundaries.
This topic describes the general process for converting an existing, connected cluster into a disconnected cluster.
12.1. About the mirror registry
You can mirror the images that are required for OpenShift Container Platform installation and subsequent product updates to a container mirror registry such as Red Hat Quay, JFrog Artifactory, Sonatype Nexus Repository, or Harbor. If you do not have access to a large-scale container registry, you can use the mirror registry for Red Hat OpenShift, a small-scale container registry included with OpenShift Container Platform subscriptions.
You can use any container registry that supports Docker v2-2, such as Red Hat Quay, the mirror registry for Red Hat OpenShift, Artifactory, Sonatype Nexus Repository, or Harbor. 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.
12.2. Prerequisites
- 
						The occlient is installed.
- A running cluster.
- An installed mirror registry, which is a container image registry that supports Docker v2-2 in the location that will host the OpenShift Container Platform cluster, such as one of the following registries: - If you have an subscription to Red Hat Quay, see the documentation on deploying Red Hat Quay for proof-of-concept purposes or by using the Quay Operator. 
- The mirror repository must be configured to share images. For example, a Red Hat Quay repository requires Organizations in order to share images.
- Access to the internet to obtain the necessary container images.
12.3. Preparing the cluster for mirroring
Before disconnecting your cluster, you must mirror, or copy, the images to a mirror registry that is reachable by every node in your disconnected cluster. In order to mirror the images, you must prepare your cluster by:
- Adding the mirror registry certificates to the list of trusted CAs on your host.
- 
						Creating a .dockerconfigjsonfile that contains your image pull secret, which is from thecloud.openshift.comtoken.
Procedure
- Configuring credentials that allow image mirroring: - Add the CA certificate for the mirror registry, in the simple PEM or DER file formats, to the list of trusted CAs. For example: - cp </path/to/cert.crt> /usr/share/pki/ca-trust-source/anchors/ - $ cp </path/to/cert.crt> /usr/share/pki/ca-trust-source/anchors/- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - where, </path/to/cert.crt>
- Specifies the path to the certificate on your local file system.
 
- where, 
- Update the CA trust. For example, in Linux: - update-ca-trust - $ update-ca-trust- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Extract the - .dockerconfigjsonfile from the global pull secret:- oc extract secret/pull-secret -n openshift-config --confirm --to=. - $ oc extract secret/pull-secret -n openshift-config --confirm --to=.- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - .dockerconfigjson - .dockerconfigjson- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Edit the - .dockerconfigjsonfile to add your mirror registry and authentication credentials and save it as a new file:- {"auths":{"<local_registry>": {"auth": "<credentials>","email": "you@example.com"}}},"<registry>:<port>/<namespace>/":{"auth":"<token>"}}}- {"auths":{"<local_registry>": {"auth": "<credentials>","email": "you@example.com"}}},"<registry>:<port>/<namespace>/":{"auth":"<token>"}}}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - where: - <local_registry>
- Specifies the registry domain name, and optionally the port, that your mirror registry uses to serve content.
- auth
- Specifies the base64-encoded user name and password for your mirror registry.
- <registry>:<port>/<namespace>
- Specifies the mirror registry details.
- <token>
- Specifies the base64-encoded - username:passwordfor your mirror registry.- For example: - {"auths":{"cloud.openshift.com":{"auth":"b3BlbnNoaWZ0Y3UjhGOVZPT0lOMEFaUjdPUzRGTA==","email":"user@example.com"},- $ {"auths":{"cloud.openshift.com":{"auth":"b3BlbnNoaWZ0Y3UjhGOVZPT0lOMEFaUjdPUzRGTA==","email":"user@example.com"}, "quay.io":{"auth":"b3BlbnNoaWZ0LXJlbGVhc2UtZGOVZPT0lOMEFaUGSTd4VGVGVUjdPUzRGTA==","email":"user@example.com"}, "registry.connect.redhat.com"{"auth":"NTE3MTMwNDB8dWhjLTFEZlN3VHkxOSTd4VGVGVU1MdTpleUpoYkdjaUailA==","email":"user@example.com"}, "registry.redhat.io":{"auth":"NTE3MTMwNDB8dWhjLTFEZlN3VH3BGSTd4VGVGVU1MdTpleUpoYkdjaU9fZw==","email":"user@example.com"}, "registry.svc.ci.openshift.org":{"auth":"dXNlcjpyWjAwWVFjSEJiT2RKVW1pSmg4dW92dGp1SXRxQ3RGN1pwajJhN1ZXeTRV"},"my-registry:5000/my-namespace/":{"auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
 
12.4. Mirroring the images
After the cluster is properly configured, you can mirror the images from your external repositories to the mirror repository.
Procedure
- Mirror the Operator Lifecycle Manager (OLM) images: - oc adm catalog mirror registry.redhat.io/redhat/redhat-operator-index:v{product-version} <mirror_registry>:<port>/olm -a <reg_creds>- $ oc adm catalog mirror registry.redhat.io/redhat/redhat-operator-index:v{product-version} <mirror_registry>:<port>/olm -a <reg_creds>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - where: - product-version
- 
									Specifies the tag that corresponds to the version of OpenShift Container Platform to install, such as 4.8.
- mirror_registry
- 
									Specifies the fully qualified domain name (FQDN) for the target registry and namespace to mirror the Operator content to, where <namespace>is any existing namespace on the registry.
- reg_creds
- 
									Specifies the location of your modified .dockerconfigjsonfile.
 - For example: - oc adm catalog mirror registry.redhat.io/redhat/redhat-operator-index:v4.8 mirror.registry.com:443/olm -a ./.dockerconfigjson --index-filter-by-os='.*' - $ oc adm catalog mirror registry.redhat.io/redhat/redhat-operator-index:v4.8 mirror.registry.com:443/olm -a ./.dockerconfigjson --index-filter-by-os='.*'- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Mirror the content for any other Red Hat-provided Operator: - oc adm catalog mirror <index_image> <mirror_registry>:<port>/<namespace> -a <reg_creds> - $ oc adm catalog mirror <index_image> <mirror_registry>:<port>/<namespace> -a <reg_creds>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - where: - index_image
- Specifies the index image for the catalog that you want to mirror.
- mirror_registry
- 
									Specifies the FQDN for the target registry and namespace to mirror the Operator content to, where <namespace>is any existing namespace on the registry.
- reg_creds
- Optional: Specifies the location of your registry credentials file, if required.
 - For example: - oc adm catalog mirror registry.redhat.io/redhat/community-operator-index:v4.8 mirror.registry.com:443/olm -a ./.dockerconfigjson --index-filter-by-os='.*' - $ oc adm catalog mirror registry.redhat.io/redhat/community-operator-index:v4.8 mirror.registry.com:443/olm -a ./.dockerconfigjson --index-filter-by-os='.*'- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Mirror the OpenShift Container Platform image repository: - oc adm release mirror -a .dockerconfigjson --from=quay.io/openshift-release-dev/ocp-release:v<product-version>-<architecture> --to=<local_registry>/<local_repository> --to-release-image=<local_registry>/<local_repository>:v<product-version>-<architecture> - $ oc adm release mirror -a .dockerconfigjson --from=quay.io/openshift-release-dev/ocp-release:v<product-version>-<architecture> --to=<local_registry>/<local_repository> --to-release-image=<local_registry>/<local_repository>:v<product-version>-<architecture>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - where: - product-version
- 
									Specifies the tag that corresponds to the version of OpenShift Container Platform to install, such as 4.8.15-x86_64.
- architecture
- 
									Specifies the type of architecture for your server, such as x86_64.
- local_registry
- Specifies the registry domain name for your mirror repository.
- local_repository
- 
									Specifies the name of the repository to create in your registry, such as ocp4/openshift4.
 - For example: - oc adm release mirror -a .dockerconfigjson --from=quay.io/openshift-release-dev/ocp-release:4.8.15-x86_64 --to=mirror.registry.com:443/ocp/release --to-release-image=mirror.registry.com:443/ocp/release:4.8.15-x86_64 - $ oc adm release mirror -a .dockerconfigjson --from=quay.io/openshift-release-dev/ocp-release:4.8.15-x86_64 --to=mirror.registry.com:443/ocp/release --to-release-image=mirror.registry.com:443/ocp/release:4.8.15-x86_64- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Mirror any other registries, as needed: - oc image mirror <online_registry>/my/image:latest <mirror_registry> - $ oc image mirror <online_registry>/my/image:latest <mirror_registry>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Additional information
- For more information about mirroring Operator catalogs, see Mirroring an Operator catalog.
- 
						For more information about the oc adm catalog mirrorcommand, see the OpenShift CLI administrator command reference.
12.5. Configuring the cluster for the mirror registry
After creating and mirroring the images to the mirror registry, you must modify your cluster so that pods can pull images from the mirror registry.
You must:
- Add the mirror registry credentials to the global pull secret.
- Add the mirror registry server certificate to the cluster.
- Create an - ImageContentSourcePolicycustom resource (ICSP), which associates the mirror registry with the source registry.- Add mirror registry credential to the cluster global pull-secret: - oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=<pull_secret_location> - $ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=<pull_secret_location>- 1 - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Provide the path to the new pull secret file.
 - For example: - oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=.mirrorsecretconfigjson - $ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=.mirrorsecretconfigjson- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Add the CA-signed mirror registry server certificate to the nodes in the cluster: - Create a config map that includes the server certificate for the mirror registry - oc create configmap <config_map_name> --from-file=<mirror_address_host>..<port>=$path/ca.crt -n openshift-config - $ oc create configmap <config_map_name> --from-file=<mirror_address_host>..<port>=$path/ca.crt -n openshift-config- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - For example: - S oc create configmap registry-config --from-file=mirror.registry.com..443=/root/certs/ca-chain.cert.pem -n openshift-config - S oc create configmap registry-config --from-file=mirror.registry.com..443=/root/certs/ca-chain.cert.pem -n openshift-config- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Use the config map to update the - image.config.openshift.io/clustercustom resource (CR). OpenShift Container Platform applies the changes to this CR to all nodes in the cluster:- oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"<config_map_name>"}}}' --type=merge- $ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"<config_map_name>"}}}' --type=merge- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - For example: - oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge- $ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
- Create an ICSP to redirect container pull requests from the online registries to the mirror registry: - Create the - ImageContentSourcePolicycustom resource:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create the ICSP object: - oc create -f registryrepomirror.yaml - $ oc create -f registryrepomirror.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - imagecontentsourcepolicy.operator.openshift.io/mirror-ocp created - imagecontentsourcepolicy.operator.openshift.io/mirror-ocp created- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - OpenShift Container Platform applies the changes to this CR to all nodes in the cluster. 
 
- Verify that the credentials, CA, and ICSP for mirror registry were added: - Log into a node: - oc debug node/<node_name> - $ oc debug node/<node_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set - /hostas the root directory within the debug shell:- chroot /host - sh-4.4# chroot /host- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Check the - config.jsonfile for the credentials:- cat /var/lib/kubelet/config.json - sh-4.4# cat /var/lib/kubelet/config.json- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - {"auths":{"brew.registry.redhat.io":{"xx=="},"brewregistry.stage.redhat.io":{"auth":"xxx=="},"mirror.registry.com:443":{"auth":"xx="}}}- {"auths":{"brew.registry.redhat.io":{"xx=="},"brewregistry.stage.redhat.io":{"auth":"xxx=="},"mirror.registry.com:443":{"auth":"xx="}}}- 1 - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Ensure that the mirror registry and credentials are present.
 
- Change to the - certs.ddirectory- cd /etc/docker/certs.d/ - sh-4.4# cd /etc/docker/certs.d/- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- List the certificates in the - certs.ddirectory:- ls - sh-4.4# ls- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - image-registry.openshift-image-registry.svc.cluster.local:5000 image-registry.openshift-image-registry.svc:5000 mirror.registry.com:443 - image-registry.openshift-image-registry.svc.cluster.local:5000 image-registry.openshift-image-registry.svc:5000 mirror.registry.com:443- 1 - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Ensure that the mirror registry is in the list.
 
- Check that the ICSP added the mirror registry to the - registries.conffile:- cat /etc/containers/registries.conf - sh-4.4# cat /etc/containers/registries.conf- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - The - registry.mirrorparameters indicate that the mirror registry is searched before the original registry.
- Exit the node. - exit - sh-4.4# exit- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
 
12.6. Ensure applications continue to work
Before disconnecting the cluster from the network, ensure that your cluster is working as expected and all of your applications are working as expected.
Procedure
Use the following commands to check the status of your cluster:
- Ensure your pods are running: - oc get pods --all-namespaces - $ oc get pods --all-namespaces- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Ensure your nodes are in the READY status: - oc get nodes - $ oc get nodes- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
12.7. Disconnect the cluster from the network
After mirroring all the required repositories and configuring your cluster to work as a disconnected cluster, you can disconnect the cluster from the network.
The Insights Operator is degraded when the cluster loses its Internet connection. You can avoid this problem by temporarily disabling the Insights Operator until you can restore it.
12.8. Restoring a degraded Insights Operator
Disconnecting the cluster from the network necessarily causes the cluster to lose the Internet connection. The Insights Operator becomes degraded because it requires access to Red Hat Insights.
This topic describes how to recover from a degraded Insights Operator.
Procedure
- Edit your - .dockerconfigjsonfile to remove the- cloud.openshift.comentry, for example:- "cloud.openshift.com":{"auth":"<hash>","email":"user@example.com"}- "cloud.openshift.com":{"auth":"<hash>","email":"user@example.com"}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Save the file.
- Update the cluster secret with the edited - .dockerconfigjsonfile:- oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=./.dockerconfigjson - $ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=./.dockerconfigjson- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Verify that the Insights Operator is no longer degraded: - oc get co insights - $ oc get co insights- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE insights 4.5.41 True False False 3d - NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE insights 4.5.41 True False False 3d- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
12.9. Restoring the network
If you want to reconnect a disconnected cluster and pull images from online registries, delete the cluster’s ImageContentSourcePolicy (ICSP) objects. Without the ICSP, pull requests to external registries are no longer redirected to the mirror registry.
Procedure
- View the ICSP objects in your cluster: - oc get imagecontentsourcepolicy - $ oc get imagecontentsourcepolicy- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - NAME AGE mirror-ocp 6d20h ocp4-index-0 6d18h qe45-index-0 6d15h - NAME AGE mirror-ocp 6d20h ocp4-index-0 6d18h qe45-index-0 6d15h- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Delete all the ICSP objects you created when disconnecting your cluster: - oc delete imagecontentsourcepolicy <icsp_name> <icsp_name> <icsp_name> - $ oc delete imagecontentsourcepolicy <icsp_name> <icsp_name> <icsp_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - For example: - oc delete imagecontentsourcepolicy mirror-ocp ocp4-index-0 qe45-index-0 - $ oc delete imagecontentsourcepolicy mirror-ocp ocp4-index-0 qe45-index-0- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - imagecontentsourcepolicy.operator.openshift.io "mirror-ocp" deleted imagecontentsourcepolicy.operator.openshift.io "ocp4-index-0" deleted imagecontentsourcepolicy.operator.openshift.io "qe45-index-0" deleted - imagecontentsourcepolicy.operator.openshift.io "mirror-ocp" deleted imagecontentsourcepolicy.operator.openshift.io "ocp4-index-0" deleted imagecontentsourcepolicy.operator.openshift.io "qe45-index-0" deleted- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Wait for all the nodes to restart and return to the READY status and verify that the - registries.conffile is pointing to the original registries and not the mirror registries:- Log into a node: - oc debug node/<node_name> - $ oc debug node/<node_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set - /hostas the root directory within the debug shell:- chroot /host - sh-4.4# chroot /host- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Examine the - registries.conffile:- cat /etc/containers/registries.conf - sh-4.4# cat /etc/containers/registries.conf- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - unqualified-search-registries = ["registry.access.redhat.com", "docker.io"] - unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]- 1 - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Theregistryandregistry.mirrorentries created by the ICSPs you deleted are removed.