第3章 Embedding in a RHEL for Edge image for offline use
Embedding MicroShift containers in an rpm-ostree commit means that you can run a cluster in air-gapped, disconnected, or offline environments. You can embed Red Hat build of MicroShift containers in a Red Hat Enterprise Linux for Edge (RHEL for Edge) image so that container engines do not need to pull images over a network from a container registry. Workloads can start up immediately without network connectivity.
3.1. Embedding MicroShift containers for offline deployments リンクのコピーリンクがクリップボードにコピーされました!
You can use image builder to create RHEL for Edge images with embedded MicroShift container images. To embed container images, you must add the image references to your image builder blueprint file.
Prerequisites
- You have root-user access to your build host.
- Your build host meets the image builder system requirements.
-
You installed and set up image builder and the
composer-clitool. - You created a RHEL for Edge image blueprint.
- You installed jq.
Procedure
-
Get the exact list of container image references used by the MicroShift version you are deploying. You can either install the
microshift-release-infoRPM package by following step 2 or download and unpack the RPM by following step 3. To install the
microshift-release-infoRPM package:Install the
microshift-release-infoRPM package by running the following command:$ sudo dnf install -y microshift-release-info-<release_version>Replace
<release_version>with the numerical value of the release you are deploying, using the entire version number, such as4.17.1.List the contents of the
/usr/share/microshift/releasedirectory to verify the presence of the release information files by running the following command:$ sudo ls /usr/share/microshift/releaseExample output
release-x86_64.json release-aarch64.jsonIf you installed the
microshift-release-infoRPM, proceed to step 4.
If you did not complete step 2, download and unpack the
microshift-release-infoRPM without installing it:Download the RPM package by running the following command:
$ sudo dnf download microshift-release-info-<release_version>1 - 1
- Replace
<release_version>with the numerical value of the release you are deploying, using the entire version number, such as4.17.1.
Example RPM output
microshift-release-info-4.17.1.-202511101230.p0.g7dc6a00.assembly.4.17.1.el9.noarch.rpmUnpack the RPM package without installing it by running the following command:
$ rpm2cpio <my_microshift_release_info> | cpio -idmv1 ./usr/share/microshift/release/release-aarch64.json ./usr/share/microshift/release/release-x86_64.json- 1
- Replace
<my_microshift_release_info>with the name of the RPM package from the previous step.
Define the location of your JSON file, which contains the container reference information, by running the following command:
$ RELEASE_FILE=</path/to/your/release-$(uname -m).json>1 - 1
- Replace
</path/to/your/release-$(uname -m).json>with the full path to your JSON file. Be sure to use the file needed for your architecture.
Define the location of your TOML file, which contains instructions for building the image, by running the following command:
$ BLUEPRINT_FILE=</path/to/your/blueprint.toml>1 - 1
- Replace
</path/to/your/blueprint.toml>with the full path to your TOML file.
Generate and then embed the container image references in your blueprint TOML file by running the following command:
$ jq -r '.images | .[] | ("[[containers]]\nsource = \"" + . + "\"\n")' "${RELEASE_FILE}" >> "${BLUEPRINT_FILE}"Example resulting TOML fragment showing container references
[[containers]] source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db" [[containers]] source = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:82cfef91557f9a70cff5a90accba45841a37524e9b93f98a97b20f6b2b69e5db"You can manually embed any container image by adding it to an image builder blueprint file using the following example:
Example section for manually embedding container image to a blueprint
[[containers]] source = "<my_image_pullspec_with_tag_or_digest>"Replace
<my_image_pullspec_with_tag_or_digest>with the exact reference to a container image used by the MicroShift version you are deploying.