Option 2: Mirroring images to a private registry with a portable compute or a storage device (file system)
If your cluster is not connected to the internet, you can install Automation Decision Services in your cluster by using a file system. The portable storage and compute scenarios are enabled with a file system.
Before you begin
Verify that you completed the prerequisites, prepared a host, set the environment variables, and created registry namespaces if the registry does not allow automatic creation of top-level namespaces.
Procedure
- Generate the required mirror manifests.
- Define the environment variable $TARGET_REGISTRY by running the following
command.
export TARGET_REGISTRY=<target-registry>The <target-registry> refers to the registry (hostname and port) where the images are mirrored to and accessed by the OCP cluster. For example:
172.16.0.10:5000. - Create the following environment variables with the installer image name and the version.
export CASE_NAME=ibm-ads export CASE_VERSION=1.1.0Note: Releases with interim fixes are packaged in archives with a new minor version. The version numbers follow therelease.major.minorstandard. For example, the first interim fix for 25.0.0 is packaged in the CASE version1.1.1. - Run the following command to generate mirror manifests to be used when mirroring the image to
the target registry. The $TARGET_REGISTRY refers to the registry where the images
are mirrored to and accessed by the OCP
cluster.
oc ibm-pak generate mirror-manifests $CASE_NAME file://ads-images \ --version $CASE_VERSION \ --final-registry $TARGET_REGISTRY/adsWhere
file://ads-imagesindicates to the plug-in that the images are first mirrored to a local file system (to the ads-images directory) on the machine that runs theoc image mirrorcommand. Thefinal-registry $TARGET_REGISTRY/adsargument generates a mapping file that is used by theoc image mirrorcommands. The final URL in your target registry includes the newadsnamespace in the mirrored namespace path. The namespace path can be multi-level if your target registry supports it.Note: After an upgrade, you can remove images from the previous version from the local registry by using an alternative namespace to copy the images to. For example, to alocationXnamespace.The
generate mirror-manifestscommand generates the following files in~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION:- images-mapping-to-filesystem.txt
- images-mapping-from-filesystem.txt
- image-content-source-policy.yaml
- catalog-sourcesxxx.yaml
Tip: If you are using a Red Hat® Quay.io registry and need to mirror the images to a specific organization in the registry, you can set the target to that organization. Specify the organization name in thegenerate mirror-manifestscommand:export ORGANIZATION=<your-organization> \ oc ibm-pak generate mirror-manifests $CASE_NAME file://ads-images \ --version $CASE_VERSION \ --final-registry $TARGET_REGISTRY/$ORGANIZATIONIf you do not know the value of the final registry where the images are to be mirrored, you can provide a placeholder value ofTARGET_REGISTRY. For example:oc ibm-pak generate mirror-manifests $CASE_NAME file://ads-images \ --version $CASE_VERSION \ --final-registry TARGET_REGISTRYNote:TARGET_REGISTRYused without any environment variable expansion is just a plain string that must be replaced later with the actual image registry URL when it is known to you.Restriction: Currently, you cannot select the images to mirror by their target architecture because image registries do not support sparse manifests (manifests that reference image digests outside of the package).The
~/.ibm-pakdirectory structure is built over time as you save CASEs and mirror. The following tree shows an example of the~/.ibm-pakdirectory structure:/root/.ibm-pak ├── config │ └── config.yaml ├── data │ ├── cases │ │ └── ibm-ads │ │ └── 1.1.0 │ │ ├── component-set-config.yaml │ │ ├── ibm-ads-1.1.0.tgz │ │ ├── xxxxxx │ └── mirror │ └── ibm-ads │ └── 1.1.0 │ ├── catalog-sources.yaml │ ├── image-content-source-policy.yaml │ ├── images-mapping-from-filesystem.txt │ └── images-mapping-to-filesystem.txt └── logs └── oc-ibm_pak.logA new directory ~/.ibm-pak/mirror is created when you issue the
oc ibm-pak generate mirror-manifestscommand. The mirror directory stores the image-content-source-policy.yaml and images-mapping.txt files.You can use the following command to list all the images in your mirror manifest and the publicly accessible registries from where the images are pulled from.
oc ibm-pak describe $CASE_NAME \ --version $CASE_VERSION \ --list-mirror-imagesTip: Make a note of the registries section at the end of output, so you can check that you can log in to the registries. You need to be able to log in to these registries to pull and mirror the images to your target registry. - Define the environment variable $TARGET_REGISTRY by running the following
command.
-
Authenticate the registries.
You must store authentication credentials for all the Automation Decision Services source Docker registries. The following registries require authentication:
cp.icr.ioregistry.redhat.ioregistry.access.redhat.com
Run the following command to configure credentials for all target registries that require authentication. You must run the command separately for each registry.
export REGISTRY_AUTH_FILE=<path to the file that has the auth credentials generated on podman login> podman login cp.icr.io podman login <TARGET_REGISTRY>Important: When you log in tocp.icr.io, you must specify the user ascpand the IBM® entitlement key as the password. For example:podman login cp.icr.io Username: cp Password: xxxxxxxxxxxxxxxxxxxxx Login Succeeded!The password can be copied from the IBM container library
. If you export
REGISTRY_AUTH_FILE=~/.ibm-pak/auth.json, and then run thepodman logincommand, you can see that the file is populated with registry credentials.If you use
docker login, the authentication file is typically located in$HOME/.docker/config.jsonon Linux® or%USERPROFILE%/.docker/config.jsonon Windows. After you run thedocker logincommand, you can exportREGISTRY_AUTH_FILEto point to that location. For example, on Linux you can run the following command:export REGISTRY_AUTH_FILE=$HOME/.docker/config.json - Mirror the images to the file system.
- Mirror images to the TARGET_REGISTRY.
oc image mirror \ -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping-to-filesystem.txt \ -a $REGISTRY_AUTH_FILE \ --filter-by-os '.*' \ --insecure \ --skip-multiple-scopes \ --max-per-registry=1The command creates a
v2folder in the current directory where all the images are copied. For example, iffile://ads-imagesis used as the input to generate the mirror-manifests, then the command creates a subdirectoryads-imagesunderv2and copies the images in this folder.The following command can be used to see all the available options.
oc image mirror --helpYou can use the
continue-on-errorparameter to continue the mirroring even if an error occurs.Based on the number and size of the images to mirror, the
oc image mirrorcommand can take a considerable amount of time. If you are running the command on a remote machine, run the command in the background with thenohupPOSIX command so that it does not stop if the user logs out. The following command starts the mirroring process in the background and writes the log to a my-mirror-progress.txt file.nohup oc image mirror -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping-to-filesystem.txt \ --filter-by-os '.*' -a $REGISTRY_AUTH_FILE \ --insecure \ --skip-multiple-scopes \ --max-per-registry=1 \ --continue-on-error=true > my-mirror-progress.txt 2>&1 &You can view the progress of the mirror command by running the following command on the remote machine:
tail -f my-mirror-progress.txt - Move the following items to your file system:
- The v2 directory.
- The
authfile referred to by the$REGISTSRY_AUTH_FILEvariable. - The
~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping-from-filesystem.txtfile.
- Mirror images to the TARGET_REGISTRY.
- Mirror the images to the target registry from your file system.
The following steps to copy the images from the file system to the
$TARGET_REGISTRYmust be completed on your file system. Your file system must be connected to both the local Docker registry and the OpenShift® Container Platform cluster.Important: If you used the placeholder value ofTARGET_REGISTRYfor the--final-registryparameter when you generated the mirror manifests, replace the string in the images-mapping-from-filesystem.txt file with the registry where you want to mirror the images. For example, if you want to mirror the images to myregistry.com/mynamespace then replaceTARGET_REGISTRYwith myregistry.com/mynamespace.- Mirror the images from the v2 directory to the target registry by running
the following command:
oc image mirror \ -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping-from-filesystem.txt \ -a $REGISTRY_AUTH_FILE \ --from-dir=${v2_dir} \ --filter-by-os '.*' \ --insecure \ --skip-multiple-scopes \ --max-per-registry=1The
$v2_dirrefers to the parent directory on the file system where you copied the v2 directory. The command does not produce any console logs for about 6 - 8 minutes as it prepares the list from the CASE package. If you want, you can add verbose (-v) to the command with possible values of 3, 9, 99, and so on. - Update the global image pull secret for your OpenShift cluster to have authentication credentials in place to pull images from your $TARGET_REGISTRY as specified in
the image-content-source-policy.yaml file. For more information, see Updating the global cluster pull secret
. - Create the
ImageContentsourcePolicy.Note: Before you run the command in this step, you must be logged in to your OpenShift cluster. You do not need to be a cluster administrator to run the mirroring commands. Using theoc logincommand, log in to the Red Hat OpenShift Container Platform cluster where you plan to pull the mirrored images. You can identify your specific oc login by clicking the user drop-down menu in the Red Hat OpenShift Container Platform console, then clicking Copy Login Command.Run the following command to create
ImageContentsourcePolicy.oc apply -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/image-content-source-policy.yaml - Verify that the
ImageContentsourcePolicyresource is created.oc get imageContentSourcePolicy - Verify your cluster node status.
oc get MachineConfigPool -wAfter the
ImageContentsourcePolicyand global image pull secret are applied, the configuration of your nodes is updated sequentially. Wait until all theMachineConfigPoolsare updated before you move on to the next step. - Create a project for the CASE commands (
adsis an example) by running the following commands:Note: Before you run the command in this step, you must be logged in to your OpenShift cluster.export NAMESPACE=ads oc new-project $NAMESPACE - Optional: If you use an insecure registry, you must add the target registry to the
cluster
insecureRegistrieslist.oc patch image.config.openshift.io/cluster / --type=merge -p '{"spec":{"registrySources":{"insecureRegistries":["'${TARGET_REGISTRY}'"]}}}'
- Mirror the images from the v2 directory to the target registry by running
the following command:
What to do next
You can now go ahead and install License Service and the certificate manager. For more information, see Installing License Service and the certificate manager.