Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Mirroring container images for disconnected installations
You can use a custom container registry when you deploy MicroShift in an air-gapped network. Running your cluster in a restricted network without direct internet connectivity is possible by installing the cluster from a mirrored set of container images in a private registry.
2.1. Mirror container images into an existing registry Copiar o linkLink copiado para a área de transferência!
Using a custom air-gapped container registry, or mirror, is necessary with certain user environments and workload requirements. Mirroring allows for the transfer of container images and updates to air-gapped environments where they can be installed on a MicroShift instance.
To create an air-gapped mirror registry for MicroShift containers, you must complete the following steps:
- Get the container image list to be mirrored.
- Configure the mirroring prerequisites.
- Download images on a host with the internet access.
- Copy the downloaded image directory to an air-gapped site.
- Upload images to a mirror registry in an air-gapped site.
- Configure your MicroShift hosts to use the mirror registry.
2.2. Getting the MicroShift mirror registry container image list Copiar o linkLink copiado para a área de transferência!
To use a mirror registry, you must know which container image references are used by a specific version of MicroShift. These references are provided in the release-<arch>.json
files that are part of the microshift-release-info
RPM package.
Prerequisites
- You have installed jq.
Procedure
Access the list of container image references by using one of the following methods:
If the package is installed on the MicroShift host, get the location of the files by running the following command:
rpm -ql microshift-release-info
$ rpm -ql microshift-release-info
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
/usr/share/microshift/release/release-x86_64.json
/usr/share/microshift/release/release-x86_64.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the package is not installed on a MicroShift host, download and unpack the RPM package without installing it by running the following command:
rpm2cpio microshift-release-info*.noarch.rpm | cpio -idmv
$ rpm2cpio microshift-release-info*.noarch.rpm | cpio -idmv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
/usr/share/microshift/release/release-x86_64.json
/usr/share/microshift/release/release-x86_64.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Extract the list of container images into the
microshift-container-refs.txt
file by running the following commands:RELEASE_FILE=/usr/share/microshift/release/release-$(uname -m).json
$ RELEASE_FILE=/usr/share/microshift/release/release-$(uname -m).json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow jq -r '.images | .[]' ${RELEASE_FILE} > microshift-container-refs.txt
$ jq -r '.images | .[]' ${RELEASE_FILE} > microshift-container-refs.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After the microshift-container-refs.txt
file is created with the MicroShift container image list, you can append the file with other user-specific image references before running the mirroring procedure.
2.3. Configuring mirroring prerequisites Copiar o linkLink copiado para a área de transferência!
You must create a container image registry credentials file that allows the mirroring of images from your internet-connected mirror host to your air-gapped mirror. Follow the instructions in the "Configuring credentials that allow images to be mirrored" link provided in the "Additional resources" section. These instructions guide you to create a ~/.pull-secret-mirror.json
file on the mirror registry host that includes the user credentials for accessing the mirror.
2.3.1. Example mirror registry pull secret entry Copiar o linkLink copiado para a área de transferência!
For example, the following section is added to the pull secret file for the microshift_quay:8443
mirror registry using microshift:microshift
as username and password.
Example mirror registry section for pull secret file
"<microshift_quay:8443>": { "auth": "<microshift_auth>", "email": "<microshift_quay@example.com>" },
"<microshift_quay:8443>": {
"auth": "<microshift_auth>",
"email": "<microshift_quay@example.com>"
},
2.4. Downloading container images Copiar o linkLink copiado para a área de transferência!
After you have located the container list and completed the mirroring prerequisites, download the container images to a host with internet access.
Prerequisites
- You are logged into a host with access to the internet.
-
You have ensured that the
.pull-secret-mirror.json
file andmicroshift-containers
directory contents are available locally.
Procedure
Install the
skopeo
tool used for copying the container images by running the following command:sudo dnf install -y skopeo
$ sudo dnf install -y skopeo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variable that points to the pull secret file:
PULL_SECRET_FILE=~/.pull-secret-mirror.json
$ PULL_SECRET_FILE=~/.pull-secret-mirror.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variable that points to the list of container images:
IMAGE_LIST_FILE=~/microshift-container-refs.txt
$ IMAGE_LIST_FILE=~/microshift-container-refs.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variable that points to the destination directory for storing the downloaded data:
IMAGE_LOCAL_DIR=~/microshift-containers
$ IMAGE_LOCAL_DIR=~/microshift-containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following script to download the container images to the
${IMAGE_LOCAL_DIR}
directory:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Transfer the image set to the target environment, such as air-gapped site. Then you can upload the image set into the mirror registry.
2.5. Uploading container images to a mirror registry Copiar o linkLink copiado para a área de transferência!
To use your container images at an air-gapped site, upload them to the mirror registry using the following procedure.
Prerequisites
-
You are logged into a host with access to
microshift-quay
. -
The
.pull-secret-mirror.json
file is available locally. -
The
microshift-containers
directory contents are available locally.
Procedure
Install the
skopeo
tool used for copying the container images by running the following command:sudo dnf install -y skopeo
$ sudo dnf install -y skopeo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variables pointing to the pull secret file:
IMAGE_PULL_FILE=~/.pull-secret-mirror.json
$ IMAGE_PULL_FILE=~/.pull-secret-mirror.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variables pointing to the local container image directory:
IMAGE_LOCAL_DIR=~/microshift-containers
$ IMAGE_LOCAL_DIR=~/microshift-containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the environment variables pointing to the mirror registry URL for uploading the container images:
TARGET_REGISTRY=<registry_host>:<port>
$ TARGET_REGISTRY=<registry_host>:<port>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<registry_host>:<port>
with the host name and port of your mirror registry server.
Run the following script to upload the container images to the
${TARGET_REGISTRY}
mirror registry:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6. Configuring hosts for mirror registry access Copiar o linkLink copiado para a área de transferência!
To configure a MicroShift host to use a mirror registry, you must give the MicroShift host access to the registry by creating a configuration file that maps the Red Hat registry host names to the mirror.
Prerequisites
- Your mirror host has access to the internet.
- The mirror host can access the mirror registry.
- You configured the mirror registry for use in your restricted network.
- You downloaded the pull secret and modified it to include authentication to your mirror repository.
Procedure
- Log into your MicroShift host.
Enable the SSL certificate trust on any host accessing the mirror registry by completing the following steps:
-
Copy the
rootCA.pem
file from the mirror registry, for example,<registry_path>/quay-rootCA
, to the MicroShift host at the/etc/pki/ca-trust/source/anchors
directory. Enable the certificate in the system-wide trust store configuration by running the following command:
sudo update-ca-trust
$ sudo update-ca-trust
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Copy the
Create the
/etc/containers/registries.conf.d/999-microshift-mirror.conf
configuration file that maps the Red Hat registry host names to the mirror registry:Example mirror configuration file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<registry_host>:<port>
with the host name and port of your mirror registry server, for example,<microshift-quay:8443>
.
Enable the MicroShift service by running the following command:
sudo systemctl enable microshift
$ sudo systemctl enable microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reboot the host by running the following command:
sudo reboot
$ sudo reboot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow