Mirror the images and configure the Red Hat OpenShift cluster

Mirror the images to the target registry that is on your Red Hat® OpenShift® cluster and configure the cluster for your FTM solution.

The following sections describe how to mirror the images and configure the cluster.
  1. Generate the mirror manifests
  2. Mirror the images
  3. Configure the cluster

Generate the mirror manifests

Use the following steps to generate the mirror manifests.
  1. Define the $TARGET_REGISTRY environment variable. The target registry refers to the registry that the images are mirrored to and that the Red Hat OpenShift cluster can access. Configure the environment variable by running the following command:
    export TARGET_REGISTRY=target-registry
  2. Generate the mirror manifests to be used when mirroring from a bastion host. Run the following command:
    oc ibm-pak generate mirror-manifests \
      ${CASE_NAME} ${TARGET_REGISTRY} \
      --version ${CASE_VERSION} \
      --filter ${IMAGE_GROUP}
    The --filter argument can be used to customize which images are mirrored during an air-gapped installation. The filtering can be applied for groups and architectures. The command creates the ~/.ibm-pak/data/mirror directory to store the mirror and catalog files.
  3. Verify that the mirror manifests were generated successfully. You can use the following command to list all the images that are to be mirrored and the publicly accessible registries where those images are pulled from:
    oc ibm-pak describe $CASE_NAME --version $CASE_VERSION --list-mirror-images
    The output of this command usually has the following parts:
    • Mirroring Details from Source to Target Registry. A connected mirroring path that does not involve an intermediate registry has only this part.
    • Mirroring Details from Target to Final Registry.

Mirror the images

Use the following steps to mirror the images from the internet to the air gap registry.
  1. Mirror the images to the target registry on your cluster by running the following command on the host that is connected to both the local container registry and the Red Hat OpenShift cluster.
    oc image mirror \
      -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping.txt \
      --filter-by-os '.*' \
      -a $REGISTRY_AUTH_FILE \
      --insecure \
      --skip-multiple-scopes \
      --max-per-registry=1
    

    Based on the number and the size of the images to be mirrored, this mirror command might take a long time. If you are running the command on a remote computer, consider running the command in the background by using nohup. By using this method, the mirroring continues even if network connection to your remote computer is lost or you close the connection.

Configure the cluster

Use the following steps to configure the Red Hat OpenShift cluster.
  1. Log in to the Red Hat OpenShift cluster.
  2. Update the global image pull secret for your cluster. Your cluster needs to have the proper authentication credentials to pull images from your target registry, which is specified in the image-content-source-policy.yaml file. For more information, see Updating the global cluster pull secret.
  3. Apply the imageContentSourcePolicy manifests to your cluster by running the following command.
    oc apply -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/image-content-source-policy.yaml
  4. Verify that the imageContentSourcePolicy was applied by running the following command.
    oc get imageContentSourcePolicy
  5. Verify your cluster node status by running the following command.
    oc get nodes

    After the imageContentsourcePolicy and global image pull secret are applied, you might see the node status as Ready, Scheduling, or Disabled. Wait until all the nodes show a Ready status.