Embedding in a RHEL for Edge image
Embedding in a RHEL for Edge image
Abstract
Chapter 1. Embedding in a RHEL for Edge image using image builder Copy linkLink copied to clipboard!
Use this guide to build a RHEL image containing MicroShift.
1.1. Preparing for image building Copy linkLink copied to clipboard!
Use the image builder tool to compose customized Red Hat Enterprise Linux for Edge (RHEL for Edge) images optimized for edge deployments. You can run a MicroShift cluster with your applications on a RHEL for Edge virtual machine for development and testing first, then use your whole solution in edge production environments.
Use the following RHEL documentation to understand the full details of using RHEL for Edge:
- Read Introduction to RHEL for Edge images.
- To build an Red Hat Enterprise Linux for Edge (RHEL for Edge) 9.4 image for a given CPU architecture, you need a RHEL 9.4 build host of the same CPU architecture that meets the Image builder system requirements.
-
Follow the instructions in Installing image builder to install image builder and the
composer-cli
tool.
1.2. Enabling extended support repositories for image building Copy linkLink copied to clipboard!
If you have an extended support (EUS) release of MicroShift or Red Hat Enterprise Linux (RHEL), you must enable the RHEL EUS repositories for image builder to use. If you do not have an EUS version, you can skip these steps.
Prerequisites
- You have an EUS version of MicroShift or RHEL or are updating to one.
- You have root-user access to your build host.
- You reviewed the Red Hat Device Edge release compatibility matrix.
Keeping component versions in a supported configuration of Red Hat Device Edge can require updating MicroShift and RHEL at the same time. Ensure that your version of RHEL is compatible with the version of MicroShift you are updating to, especially if you are updating MicroShift across two minor versions. Otherwise, you can create an unsupported configuration, break your cluster, or both. For more information, see the Red Hat Device Edge release compatibility matrix.
Procedure
Create the
/etc/osbuild-composer/repositories
directory by running the following command:sudo mkdir -p /etc/osbuild-composer/repositories
$ sudo mkdir -p /etc/osbuild-composer/repositories
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the
/usr/share/osbuild-composer/repositories/rhel-9.4.json
file into the/etc/osbuild-composer/repositories
directory by running the following command:sudo cp /usr/share/osbuild-composer/repositories/rhel-9.4.json /etc/osbuild-composer/repositories/rhel-9.4.json
$ sudo cp /usr/share/osbuild-composer/repositories/rhel-9.4.json /etc/osbuild-composer/repositories/rhel-9.4.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
baseos
source by modifying the/etc/osbuild-composer/repositories/rhel-9.4.json
file with the following values:... ...
# ... "baseurl": "https://cdn.redhat.com/content/eus/rhel<9>/<9.4>//baseos/os",
1 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <9> with the major RHEL version you are using, and replace <9.4> with the <major.minor> version. Be certain that the RHEL version you choose is compatible with the MicroShift version you are using.
Optional. Apply the
baseos
update by running the following command:sudo sed -i "s,dist/rhel<9>/<9.4>/$(uname -m)/baseos/,eus/rhel<9>/<9.4>/$(uname -m)/baseos/,g" \ /etc/osbuild-composer/repositories/rhel-<9.4>.json
$ sudo sed -i "s,dist/rhel<9>/<9.4>/$(uname -m)/baseos/,eus/rhel<9>/<9.4>/$(uname -m)/baseos/,g" \ /etc/osbuild-composer/repositories/rhel-<9.4>.json
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <9> with the major RHEL version you are using, and replace <9.4> with the <major.minor> version. Be certain that the RHEL version you choose is compatible with the MicroShift version you are using.
Update the
appstream
source by modifying the/etc/osbuild-composer/repositories/rhel-<major.minor>.json
file with the following values:... ...
# ... "baseurl": "https://cdn.redhat.com/content/eus/rhel<9>/<9.4>//appstream/os",
1 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <9> with the major RHEL version you are using, and replace <9.4> with the <major.minor> version. Be certain that the RHEL version you choose is compatible with the MicroShift version you are using.
Optional. Apply the
appstream
update by running the following command:sudo sed -i "s,dist/rhel<9>/<9.4>/$(uname -m)/appstream/,eus/rhel<9>/<9.4>/$(uname -m)/appstream/,g" \ /etc/osbuild-composer/repositories/rhel-<9.4>.json
$ sudo sed -i "s,dist/rhel<9>/<9.4>/$(uname -m)/appstream/,eus/rhel<9>/<9.4>/$(uname -m)/appstream/,g" \ /etc/osbuild-composer/repositories/rhel-<9.4>.json
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <9> with the major RHEL version you are using, and replace <9.4> with the <major.minor> version. Be certain that the RHEL version you choose is compatible with the MicroShift version you are using.
Verification
You can verify the repositories by using the composer-cli
tool to display information about the source.
Verify the
baseos
source by running the following command:sudo composer-cli sources info baseos | grep 'url ='
$ sudo composer-cli sources info baseos | grep 'url ='
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
url = "https://cdn.redhat.com/content/eus/rhel9/9.4/x86_64/baseos/os"
url = "https://cdn.redhat.com/content/eus/rhel9/9.4/x86_64/baseos/os"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the
appstream
source by running the following command:sudo composer-cli sources info appstream | grep 'url ='
$ sudo composer-cli sources info appstream | grep 'url ='
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
url = "https://cdn.redhat.com/content/eus/rhel9/9.4/x86_64/appstream/os"
url = "https://cdn.redhat.com/content/eus/rhel9/9.4/x86_64/appstream/os"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3. Adding MicroShift repositories to image builder Copy linkLink copied to clipboard!
Use the following procedure to add the MicroShift repositories to image builder on your build host.
Prerequisites
- Your build host meets the image builder system requirements.
-
You have installed and set up image builder and the
composer-cli
tool. - You have root-user access to your build host.
Procedure
Create an image builder configuration file for adding the
rhocp-4.18
RPM repository source required to pull MicroShift RPMs by running the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an image builder configuration file for adding the
fast-datapath
RPM repository by running the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the sources to the image builder by running the following commands:
sudo composer-cli sources add rhocp-4.18.toml
$ sudo composer-cli sources add rhocp-4.18.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow sudo composer-cli sources add fast-datapath.toml
$ sudo composer-cli sources add fast-datapath.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Confirm that the sources were added properly by running the following command:
sudo composer-cli sources list
$ sudo composer-cli sources list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
appstream baseos fast-datapath rhocp-4.18
appstream baseos fast-datapath rhocp-4.18
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4. Adding the MicroShift service to a blueprint Copy linkLink copied to clipboard!
Adding the MicroShift RPM package to an image builder blueprint enables the build of a RHEL for Edge image with MicroShift embedded.
Procedure
Use the blueprint installed in the
/usr/share/microshift/blueprint
directory that is specific to your platform architecture. See the following example snippet for an explanation of the blueprint sections:Generated image builder blueprint example snippet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- References for all non-optional MicroShift RPM packages using the same version compatible with the
microshift-release-info
RPM. - 2
- References for automatically enabling MicroShift on system startup and applying default networking settings.
- 3
- References for all non-optional MicroShift container images necessary for an offline deployment. The SHA depends on the release you are using.
Add the blueprint to the image builder by running the following command:
sudo composer-cli blueprints push microshift_blueprint.toml
$ sudo composer-cli blueprints push microshift_blueprint.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the image builder configuration listing only MicroShift packages by running the following command:
sudo composer-cli blueprints depsolve microshift_blueprint | grep microshift
$ sudo composer-cli blueprints depsolve microshift_blueprint | grep microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
blueprint: microshift_blueprint v0.0.1 microshift-release-info-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.noarch microshift-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.x86_64
blueprint: microshift_blueprint v0.0.1 microshift-release-info-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.noarch microshift-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.x86_64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Verify the image builder configuration that lists all of the components to be installed by running the following command:
sudo composer-cli blueprints depsolve microshift_blueprint
$ sudo composer-cli blueprints depsolve microshift_blueprint
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.5. Adding other packages to a blueprint Copy linkLink copied to clipboard!
Add the references for optional RPM packages to your ostree
blueprint to enable them.
Prerequisites
- You created an image builder blueprint file.
Procedure
Edit your
ostree
blueprint by running the following command:vi <microshift_blueprint.toml>
$ vi <microshift_blueprint.toml>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<microshift_blueprint.toml>
with the name of the blueprint file used for the MicroShift service.
Add the following example text to your blueprint:
[[packages]] name = "<microshift-additional-package-name>" version = "*"
[[packages]]
1 name = "<microshift-additional-package-name>"
2 version = "*"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
- Add custom certificate authorities to the blueprint as needed.
After you are done adding to your blueprint, you can apply the manifests to an active cluster by building a new
ostree
system and deploying it on the client:- Create the ISO.
- Add the blueprint and build the ISO.
- Download the ISO and prepare it for use.
- Do any provisioning that is needed.
1.6. Adding a certificate authority bundle Copy linkLink copied to clipboard!
MicroShift uses the host trust bundle when clients evaluate server certificates. You can also use a customized security certificate chain to improve the compatibility of your endpoint certificates with clients specific to your deployments. To do this, you can add a certificate authority (CA) bundle with root and intermediate certificates to the Red Hat Enterprise Linux for Edge (RHEL for Edge) system-wide trust store.
1.6.1. Adding a certificate authority bundle to an rpm-ostree image Copy linkLink copied to clipboard!
You can include additional trusted certificate authorities (CAs) to the Red Hat Enterprise Linux for Edge (RHEL for Edge) rpm-ostree
image by adding them to the blueprint that you use to create the image. Using the following procedure sets up additional CAs to be trusted by the operating system when pulling images from an image registry.
This procedure requires you to configure the CA bundle customizations in the blueprint, and then add steps to your Kickstart file to enable the bundle. In the following steps, data
is the key, and <value>
represents the PEM-encoded certificate.
Prerequisites
- You have root user access to your build host.
- Your build host meets the image builder system requirements.
-
You have installed and set up image builder and the
composer-cli
tool.
Procedure
Add the following custom values to your blueprint to add a directory.
Add instructions to your blueprint on the host where the image is built to create the directory, for example,
/etc/pki/ca-trust/source/anchors/
for your certificate bundles.[[customizations.directories]] path = "/etc/pki/ca-trust/source/anchors"
[[customizations.directories]] path = "/etc/pki/ca-trust/source/anchors"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After the image has booted, create the certificate bundles, for example,
/etc/pki/ca-trust/source/anchors/cert1.pem
:[[customizations.files]] path = "/etc/pki/ca-trust/source/anchors/cert1.pem" data = "<value>"
[[customizations.files]] path = "/etc/pki/ca-trust/source/anchors/cert1.pem" data = "<value>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To enable the certificate bundle in the system-wide trust store configuration, use the
update-ca-trust
command on the host where the image you are using has booted, for example:sudo update-ca-trust
$ sudo update-ca-trust
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
update-ca-trust
command might be included in the%post
section of a Kickstart file used for MicroShift host installation so that all the necessary certificate trust is enabled on the first boot. You must configure the CA bundle customizations in the blueprint before adding steps to your Kickstart file to enable the bundle.%post # Update certificate trust storage in case new certificates were # installed at /etc/pki/ca-trust/source/anchors directory update-ca-trust %end
%post # Update certificate trust storage in case new certificates were # installed at /etc/pki/ca-trust/source/anchors directory update-ca-trust %end
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.7. Creating the RHEL for Edge image with image builder Copy linkLink copied to clipboard!
Use the following procedure to create the ISO. The RHEL for Edge Installer image pulls the commit from the running container and creates an installable boot ISO with a Kickstart file configured to use the embedded rpm-ostree
commit.
Prerequisites
- Your build host meets the image builder system requirements.
-
You installed and set up image builder and the
composer-cli
tool. - You root-user access to your build host.
-
You installed the
podman
tool.
Procedure
Start an
ostree
container image build by running the following command:BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/{op-system-version-major}/$(uname -m)/edge" <microshift_blueprint> edge-container | awk '/^Compose/ {print $2}')
$ BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/{op-system-version-major}/$(uname -m)/edge" <microshift_blueprint> edge-container | awk '/^Compose/ {print $2}')
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<microshift_blueprint>
with the name of your blueprint.
This command also returns the identification (ID) of the build for monitoring.
You can check the status of the build periodically by running the following command:
sudo composer-cli compose status
$ sudo composer-cli compose status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of a running build
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 RUNNING Wed Jun 7 12:26:23 2023 microshift_blueprint 0.0.1 edge-container
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 RUNNING Wed Jun 7 12:26:23 2023 microshift_blueprint 0.0.1 edge-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of a completed build
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 FINISHED Wed Jun 7 12:32:37 2023 microshift_blueprint 0.0.1 edge-container
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 FINISHED Wed Jun 7 12:32:37 2023 microshift_blueprint 0.0.1 edge-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
watch
command to monitor your build if you are familiar with how to start and stop it.Download the container image using the ID and get the image ready for use by running the following command:
sudo composer-cli compose image ${BUILDID}
$ sudo composer-cli compose image ${BUILDID}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the ownership of the downloaded container image to the current user by running the following command:
sudo chown $(whoami). ${BUILDID}-container.tar
$ sudo chown $(whoami). ${BUILDID}-container.tar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add read permissions for the current user to the image by running the following command:
sudo chmod a+r ${BUILDID}-container.tar
$ sudo chmod a+r ${BUILDID}-container.tar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Bootstrap a server on port 8085 for the
ostree
container image to be consumed by the ISO build by completing the following steps:Get the
IMAGEID
variable result by running the following command:IMAGEID=$(cat < "./${BUILDID}-container.tar" | sudo podman load | grep -o -P '(?<=sha256[@:])[a-z0-9]*')
$ IMAGEID=$(cat < "./${BUILDID}-container.tar" | sudo podman load | grep -o -P '(?<=sha256[@:])[a-z0-9]*')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
IMAGEID
variable result to execute the podman command step by running the following command:sudo podman run -d --name=minimal-microshift-server -p 8085:8080 ${IMAGEID}
$ sudo podman run -d --name=minimal-microshift-server -p 8085:8080 ${IMAGEID}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command also returns the ID of the container saved in the
IMAGEID
variable for monitoring.
Generate the installer blueprint file by running the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.8. Add the blueprint to image builder and build the ISO Copy linkLink copied to clipboard!
Add the blueprint to the image builder by running the following command:
sudo composer-cli blueprints push microshift-installer.toml
$ sudo composer-cli blueprints push microshift-installer.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the
ostree
ISO build by running the following command:BUILDID=$(sudo composer-cli compose start-ostree --url http://localhost:8085/repo/ --ref "rhel/9/$(uname -m)/edge" microshift-installer edge-installer | awk '{print $2}')
$ BUILDID=$(sudo composer-cli compose start-ostree --url http://localhost:8085/repo/ --ref "rhel/9/$(uname -m)/edge" microshift-installer edge-installer | awk '{print $2}')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command also returns the identification (ID) of the build for monitoring.
You can check the status of the build periodically by running the following command:
sudo composer-cli compose status
$ sudo composer-cli compose status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output for a running build
ID Status Time Blueprint Version Type Size c793c24f-ca2c-4c79-b5b7-ba36f5078e8d RUNNING Wed Jun 7 13:22:20 2023 microshift-installer 0.0.0 edge-installer
ID Status Time Blueprint Version Type Size c793c24f-ca2c-4c79-b5b7-ba36f5078e8d RUNNING Wed Jun 7 13:22:20 2023 microshift-installer 0.0.0 edge-installer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output for a completed build
ID Status Time Blueprint Version Type Size c793c24f-ca2c-4c79-b5b7-ba36f5078e8d FINISHED Wed Jun 7 13:34:49 2023 microshift-installer 0.0.0 edge-installer
ID Status Time Blueprint Version Type Size c793c24f-ca2c-4c79-b5b7-ba36f5078e8d FINISHED Wed Jun 7 13:34:49 2023 microshift-installer 0.0.0 edge-installer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.9. Download the ISO and prepare it for use Copy linkLink copied to clipboard!
Download the ISO using the ID by running the following command:
sudo composer-cli compose image ${BUILDID}
$ sudo composer-cli compose image ${BUILDID}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the ownership of the downloaded container image to the current user by running the following command:
sudo chown $(whoami). ${BUILDID}-installer.iso
$ sudo chown $(whoami). ${BUILDID}-installer.iso
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add read permissions for the current user to the image by running the following command:
sudo chmod a+r ${BUILDID}-installer.iso
$ sudo chmod a+r ${BUILDID}-installer.iso
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
- Provision a virtual machine with a Kickstart file.
1.9.1. Embedding a Kickstart file in an ISO Copy linkLink copied to clipboard!
You can use the Kickstart file provided with MicroShift, or you can update an existing RHEL for Edge Installer (ISO) Kickstart file. When ready, embed the Kickstart file into the ISO. Your Kickstart file must include detailed instructions about how to create a user and how to fetch and deploy the RHEL for Edge image.
Prerequisites
- You created a RHEL for Edge Installer (ISO) image containing your RHEL for Edge commit with MicroShift.
-
You have an existing Kickstart file ready for updating. You can use the
microshift-starter.ks
Kickstart file provided with the MicroShift RPMs.
Procedure
In the main section of the Kickstart file, update the setup of the filesystem such that it contains an LVM volume group called
rhel
with at least 10GB system root. Leave free space for the LVMS CSI driver to use for storing the data for your workloads.Example Kickstart file snippet for configuring the filesystem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
%post
section of the Kickstart file, add your pull secret and the mandatory firewall rules.Example Kickstart file snippet for adding the pull secret and firewall rules
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
mkksiso
tool by running the following command:sudo yum install -y lorax
$ sudo yum install -y lorax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the ISO with your new Kickstart file by running the following command:
sudo mkksiso <your_kickstart>.ks <your_installer>.iso <updated_installer>.iso
$ sudo mkksiso <your_kickstart>.ks <your_installer>.iso <updated_installer>.iso
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.10. How to access the MicroShift cluster Copy linkLink copied to clipboard!
Use the procedures in this section to access the MicroShift cluster by using the OpenShift CLI (oc
).
- You can access the cluster from either the same machine running the MicroShift service or from a remote location.
- You can use this access to observe and administrate workloads.
-
When using the following steps, choose the
kubeconfig
file that contains the host name or IP address you want to connect to and place it in the relevant directory.
1.10.1. Accessing the MicroShift cluster locally Copy linkLink copied to clipboard!
Use the following procedure to access the MicroShift cluster locally by using a kubeconfig
file.
Prerequisites
-
You have installed the
oc
binary.
Procedure
Optional: to create a
~/.kube/
folder if your Red Hat Enterprise Linux (RHEL) machine does not have one, run the following command:mkdir -p ~/.kube/
$ mkdir -p ~/.kube/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the generated local access
kubeconfig
file to the~/.kube/
directory by running the following command:sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/config
$ sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the permissions on your
~/.kube/config
file by running the following command:chmod go-r ~/.kube/config
$ chmod go-r ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that MicroShift is running by entering the following command:
oc get all -A
$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.10.2. Opening the firewall for remote access to the MicroShift cluster Copy linkLink copied to clipboard!
Use the following procedure to open the firewall so that a remote user can access the MicroShift cluster. This procedure must be completed before a workstation user can access the cluster remotely.
For this procedure, user@microshift
is the user on the MicroShift host machine and is responsible for setting up that machine so that it can be accessed by a remote user on a separate workstation.
Prerequisites
-
You have installed the
oc
binary. - Your account has cluster administration privileges.
Procedure
As
user@microshift
on the MicroShift host, open the firewall port for the Kubernetes API server (6443/tcp
) by running the following command:sudo firewall-cmd --permanent --zone=public --add-port=6443/tcp && sudo firewall-cmd --reload
[user@microshift]$ sudo firewall-cmd --permanent --zone=public --add-port=6443/tcp && sudo firewall-cmd --reload
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
As
user@microshift
, verify that MicroShift is running by entering the following command:oc get all -A
[user@microshift]$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.10.3. Accessing the MicroShift cluster remotely Copy linkLink copied to clipboard!
Use the following procedure to access the MicroShift cluster from a remote location by using a kubeconfig
file.
The user@workstation
login is used to access the host machine remotely. The <user>
value in the procedure is the name of the user that user@workstation
logs in with to the MicroShift host.
Prerequisites
-
You have installed the
oc
binary. -
The
user@microshift
has opened the firewall from the local host.
Procedure
As
user@workstation
, create a~/.kube/
folder if your Red Hat Enterprise Linux (RHEL) machine does not have one by running the following command:mkdir -p ~/.kube/
[user@workstation]$ mkdir -p ~/.kube/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow As
user@workstation
, set a variable for the hostname of your MicroShift host by running the following command:MICROSHIFT_MACHINE=<name or IP address of MicroShift machine>
[user@workstation]$ MICROSHIFT_MACHINE=<name or IP address of MicroShift machine>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow As
user@workstation
, copy the generatedkubeconfig
file that contains the host name or IP address you want to connect with from the RHEL machine running MicroShift to your local machine by running the following command:ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/config
[user@workstation]$ ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteTo generate the
kubeconfig
files for this step, see Generating additional kubeconfig files for remote access.As
user@workstation
, update the permissions on your~/.kube/config
file by running the following command:chmod go-r ~/.kube/config
$ chmod go-r ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
As
user@workstation
, verify that MicroShift is running by entering the following command:oc get all -A
[user@workstation]$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 2. Embedding in a RHEL for Edge image for offline use Copy linkLink copied to clipboard!
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 immediately without network connectivity.
2.1. Embedding MicroShift containers for offline deployments Copy linkLink copied to clipboard!
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-cli
tool. - 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-info
RPM package by following step 2 or download and unpack the RPM by following step 3. To install the
microshift-release-info
RPM package:Install the
microshift-release-info
RPM package by running the following command:sudo dnf install -y microshift-release-info-<release_version>
$ sudo dnf install -y microshift-release-info-<release_version>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<release_version>
with the numerical value of the release you are deploying, using the entire version number, such as4.18.1
.List the contents of the
/usr/share/microshift/release
directory to verify the presence of the release information files by running the following command:sudo ls /usr/share/microshift/release
$ sudo ls /usr/share/microshift/release
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
release-x86_64.json release-aarch64.json
release-x86_64.json release-aarch64.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you installed the
microshift-release-info
RPM, proceed to step 4.
If you did not complete step 2, download and unpack the
microshift-release-info
RPM without installing it:Download the RPM package by running the following command:
sudo dnf download microshift-release-info-<release_version>
$ sudo dnf download microshift-release-info-<release_version>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<release_version>
with the numerical value of the release you are deploying, using the entire version number, such as4.18.1
.
Example RPM output
microshift-release-info-4.18.1.-202511101230.p0.g7dc6a00.assembly.4.18.1.el9.noarch.rpm
microshift-release-info-4.18.1.-202511101230.p0.g7dc6a00.assembly.4.18.1.el9.noarch.rpm
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Unpack the RPM package without installing it by running the following command:
rpm2cpio <my_microshift_release_info> | cpio -idmv
$ rpm2cpio <my_microshift_release_info> | cpio -idmv
1 ./usr/share/microshift/release/release-aarch64.json ./usr/share/microshift/release/release-x86_64.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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>
$ RELEASE_FILE=</path/to/your/release-$(uname -m).json>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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>
$ BLUEPRINT_FILE=</path/to/your/blueprint.toml>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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}"
$ jq -r '.images | .[] | ("[[containers]]\nsource = \"" + . + "\"\n")' "${RELEASE_FILE}" >> "${BLUEPRINT_FILE}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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"
[[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"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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>"
[[containers]] source = "<my_image_pullspec_with_tag_or_digest>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<my_image_pullspec_with_tag_or_digest>
with the exact reference to a container image used by the MicroShift version you are deploying.
2.2. Adding registry authentication to prepare for image building Copy linkLink copied to clipboard!
After you have updated the blueprint, you must add authentication for the container registries to build the image with embedded MicroShift containers. To do this, update one of the systemd service files that are part of the Image Builder configuration.
Prerequisites
- You have root-user access to your build host.
- Your build host meets the Image Builder system requirements.
-
You have installed and set up Image Builder and the
composer-cli
tool.
You can create an /etc/osbuild-worker/osbuild-worker.toml
directory and configuration file if they do not exist.
Procedure
Add a pull secret for authenticating to the registry by setting the
auth_file_path
in the[containers]
section of the/etc/osbuild-worker/osbuild-worker.toml
configuration file:[containers] auth_file_path = "/etc/osbuild-worker/pull-secret.json"
[containers] auth_file_path = "/etc/osbuild-worker/pull-secret.json"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the host to apply configuration changes.
2.3. Build and use the rpm-ostree image for offline deployments Copy linkLink copied to clipboard!
You can use image builder to create rpm-ostree
system images with embedded MicroShift container images. To embed container images, you must add the image references to your image builder blueprint. You can create the commit and ISO as needed for your use case.
Add the prerequisites listed here to the ones that are included in the procedures that follow.
2.3.1. Additional prerequisites for offline deployments Copy linkLink copied to clipboard!
- You have created and updated a RHEL for Edge image blueprint for offline use. The following procedures use the example of a blueprint created with container images. You must use the updated blueprint you created in the "Embedding MicroShift containers for offline deployments" procedure.
-
You have updated the
/etc/osbuild-worker/osbuild-worker.toml
configuration file for offline use.
Replace minimal-microshift.toml
in the following procedures with the name of the TOML you updated for offline use, <my_blueprint_name>.
2.3.2. Adding the MicroShift service to a blueprint Copy linkLink copied to clipboard!
Adding the MicroShift RPM package to an image builder blueprint enables the build of a RHEL for Edge image with MicroShift embedded.
Procedure
Use the blueprint installed in the
/usr/share/microshift/blueprint
directory that is specific to your platform architecture. See the following example snippet for an explanation of the blueprint sections:Generated image builder blueprint example snippet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- References for all non-optional MicroShift RPM packages using the same version compatible with the
microshift-release-info
RPM. - 2
- References for automatically enabling MicroShift on system startup and applying default networking settings.
- 3
- References for all non-optional MicroShift container images necessary for an offline deployment. The SHA depends on the release you are using.
Add the blueprint to the image builder by running the following command:
sudo composer-cli blueprints push microshift_blueprint.toml
$ sudo composer-cli blueprints push microshift_blueprint.toml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the image builder configuration listing only MicroShift packages by running the following command:
sudo composer-cli blueprints depsolve microshift_blueprint | grep microshift
$ sudo composer-cli blueprints depsolve microshift_blueprint | grep microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
blueprint: microshift_blueprint v0.0.1 microshift-release-info-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.noarch microshift-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.x86_64
blueprint: microshift_blueprint v0.0.1 microshift-release-info-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.noarch microshift-4.18.1-202511250827.p0.g4105d3b.assembly.4.18.1.el9.x86_64
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Verify the image builder configuration that lists all of the components to be installed by running the following command:
sudo composer-cli blueprints depsolve microshift_blueprint
$ sudo composer-cli blueprints depsolve microshift_blueprint
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3.3. Creating the RHEL for Edge image with image builder Copy linkLink copied to clipboard!
Use the following procedure to create the ISO. The RHEL for Edge Installer image pulls the commit from the running container and creates an installable boot ISO with a Kickstart file configured to use the embedded rpm-ostree
commit.
Prerequisites
- Your build host meets the image builder system requirements.
-
You installed and set up image builder and the
composer-cli
tool. - You root-user access to your build host.
-
You installed the
podman
tool.
Procedure
Start an
ostree
container image build by running the following command:BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/{op-system-version-major}/$(uname -m)/edge" <microshift_blueprint> edge-container | awk '/^Compose/ {print $2}')
$ BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/{op-system-version-major}/$(uname -m)/edge" <microshift_blueprint> edge-container | awk '/^Compose/ {print $2}')
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<microshift_blueprint>
with the name of your blueprint.
This command also returns the identification (ID) of the build for monitoring.
You can check the status of the build periodically by running the following command:
sudo composer-cli compose status
$ sudo composer-cli compose status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of a running build
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 RUNNING Wed Jun 7 12:26:23 2023 microshift_blueprint 0.0.1 edge-container
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 RUNNING Wed Jun 7 12:26:23 2023 microshift_blueprint 0.0.1 edge-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of a completed build
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 FINISHED Wed Jun 7 12:32:37 2023 microshift_blueprint 0.0.1 edge-container
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 FINISHED Wed Jun 7 12:32:37 2023 microshift_blueprint 0.0.1 edge-container
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
watch
command to monitor your build if you are familiar with how to start and stop it.Download the container image using the ID and get the image ready for use by running the following command:
sudo composer-cli compose image ${BUILDID}
$ sudo composer-cli compose image ${BUILDID}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the ownership of the downloaded container image to the current user by running the following command:
sudo chown $(whoami). ${BUILDID}-container.tar
$ sudo chown $(whoami). ${BUILDID}-container.tar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add read permissions for the current user to the image by running the following command:
sudo chmod a+r ${BUILDID}-container.tar
$ sudo chmod a+r ${BUILDID}-container.tar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Bootstrap a server on port 8085 for the
ostree
container image to be consumed by the ISO build by completing the following steps:Get the
IMAGEID
variable result by running the following command:IMAGEID=$(cat < "./${BUILDID}-container.tar" | sudo podman load | grep -o -P '(?<=sha256[@:])[a-z0-9]*')
$ IMAGEID=$(cat < "./${BUILDID}-container.tar" | sudo podman load | grep -o -P '(?<=sha256[@:])[a-z0-9]*')
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
IMAGEID
variable result to execute the podman command step by running the following command:sudo podman run -d --name=minimal-microshift-server -p 8085:8080 ${IMAGEID}
$ sudo podman run -d --name=minimal-microshift-server -p 8085:8080 ${IMAGEID}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command also returns the ID of the container saved in the
IMAGEID
variable for monitoring.
Generate the installer blueprint file by running the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow