MicroShift is Technology Preview software only.
For more information about the support scope of Red Hat Technology Preview software, see Technology Preview Support Scope.Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 2. Embedding MicroShift in a RHEL for Edge image
You can embed MicroShift into a Red Hat Enterprise Linux (RHEL) for Edge 9.2 image. Use this guide to build a RHEL image containing MicroShift.
MicroShift is Technology Preview only. This Technology Preview software is not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using MicroShift in production. Technology Preview provides early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
Red Hat does not support an update path from the Technology Preview version to later versions of MicroShift. A new installation is necessary.
For more information about the support scope of Red Hat Technology Preview features, read Technology Preview Features Support Scope.
2.1. Preparing for image building Link kopierenLink in die Zwischenablage kopiert!
Read Composing, installing, and managing RHEL for Edge images.
MicroShift 4.13 deployments have only been tested with Red Hat Enterprise Linux (RHEL) for Edge 9.2. Other versions of RHEL are not supported.
To build an Red Hat Enterprise Linux (RHEL) for Edge 9.2 image for a given CPU architecture, you need a RHEL 9.2 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.
2.2. Adding MicroShift repositories to Image Builder Link kopierenLink in die Zwischenablage kopiert!
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.13
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.13.toml
$ sudo composer-cli sources add rhocp-4.13.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.13
appstream baseos fast-datapath rhocp-4.13
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Adding the MicroShift service to a blueprint Link kopierenLink in die Zwischenablage kopiert!
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 following example to create your blueprint:
Image Builder blueprint example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Optional
microshift-greenboot
RPM. For more information, read the "Greenboot health check" guide in the "Running Applications" section.
NoteThe wildcard
*
in the commands uses the latest MicroShift RPMs. If you need a specific version, substitute the wildcard for the version you want. For example, insert4.13.1
to download the MicroShift 4.13.1 RPMs.Add the blueprint to the Image Builder by running the following command:
sudo composer-cli blueprints push minimal-microshift.toml
$ sudo composer-cli blueprints push minimal-microshift.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 minimal-microshift | grep microshift
$ sudo composer-cli blueprints depsolve minimal-microshift | grep microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Verify the Image Builder configuration listing all components to be installed by running the following command:
sudo composer-cli blueprints depsolve minimal-microshift
$ sudo composer-cli blueprints depsolve minimal-microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.4. Creating the Red Hat Enterprise Linux (RHEL) for Edge image Link kopierenLink in die Zwischenablage kopiert!
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 OSTree commit.
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.
-
You have the
podman
tool.
Procedure
Start an
ostree
container image build by running the following command:BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/9/$(uname -m)/edge" minimal-microshift edge-container | awk '{print $2}')
$ BUILDID=$(sudo composer-cli compose start-ostree --ref "rhel/9/$(uname -m)/edge" minimal-microshift edge-container | 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 of a running build
ID Status Time Blueprint Version Type Size cc3377ec-4643-4483-b0e7-6b0ad0ae6332 RUNNING Wed Jun 7 12:26:23 2023 minimal-microshift 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 minimal-microshift 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 minimal-microshift 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 minimal-microshift 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
2.5. Add the blueprint to Image Builder and build the ISO Link kopierenLink in die Zwischenablage kopiert!
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
2.6. Download the ISO and prepare it for use Link kopierenLink in die Zwischenablage kopiert!
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
2.7. Provisioning a machine for MicroShift Link kopierenLink in die Zwischenablage kopiert!
Provision a machine with your RHEL for Edge image by using the procedures from the RHEL for Edge documentation.
To use MicroShift, you must provision the system so that it meets the following requirements:
- The machine you are provisioning must meet the system requirements for installing MicroShift.
- The file system must have a logical volume manager (LVM) volume group (VG) with sufficient capacity for the persistent volumes (PVs) of your workload.
-
A pull secret from the Red Hat Hybrid Cloud Console must be present as
/etc/crio/openshift-pull-secret
and have root user-only read/write permissions. - The firewall must be configured with MicroShift’s required firewall settings.
If you are using a Kickstart such as the RHEL for Edge Installer (ISO) image, you can update your Kickstart file to meet the provisioning requirements.
Prerequisites
You have created an RHEL for Edge Installer (ISO) image containing your RHEL for Edge commit with MicroShift.
- This requirement includes the steps of composing an RFE Container image, creating the RFE Installer blueprint, starting the RFE container, and composing the RFE Installer image.
Create a Kickstart file or use an existing one. In the Kickstart file, you must include:
- Detailed instructions about how to create a user.
- How to fetch and deploy the RHEL for Edge image.
For more information, read "Additional resources."
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 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 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 Kickstart file in 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
2.8. How to access the MicroShift cluster Link kopierenLink in die Zwischenablage kopiert!
Use the procedures in this section to access the MicroShift cluster, either from the same machine running the MicroShift service or remotely from a workstation. You can use this access to observe and administrate workloads. When using these steps, choose the kubeconfig
file that contains the host name or IP address you want to connect with and place it in the relevant directory. As listed in each procedure, you use the OpenShift Container Platform CLI tool (oc
) for cluster activities.
2.8.1. Accessing the MicroShift cluster locally Link kopierenLink in die Zwischenablage kopiert!
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 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
2.8.2. Opening the firewall for remote access to the MicroShift cluster Link kopierenLink in die Zwischenablage kopiert!
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
2.8.3. Accessing the MicroShift cluster remotely Link kopierenLink in die Zwischenablage kopiert!
Use the following procedure to access the MicroShift cluster from a remote workstation 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 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 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