Using RHEL Kickstarts
Using a Kickstart file that automates the installation of a RHEL image with MicroShift
Abstract
Chapter 1. Using Kickstart files for installing MicroShift in RHEL
You can use a Kickstart file to automate installation of an RHEL image with MicroShift.
1.1. Kickstart files for embedding MicroShift with a RHEL installation
Kickstart files automate RHEL installation and can embed MicroShift on the same host. You can use a Kickstart file to provision virtual machines or complete edge deployments when the file meets MicroShift storage and pull-secret requirements.
By using a Kickstart file, you automate a typical Red Hat Enterprise Linux (RHEL) installation by creating a single file containing all of the information required for success.
- You can also automate your MicroShift installation by including MicroShift in the Kickstart file for the RHEL type that you choose.
- You can use a Kickstart file to provision virtual machines (VMs) or to complete a regular RHEL installation for deployment on edge devices.
For MicroShift, your Kickstart file must include information to provision the RHEL system to meet the following requirements:
- A RHEL system you provision must meet the requirements for installing MicroShift.
- The RHEL 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-secretand have root user-only read/write permissions. See "Red Hat Hybrid Cloud Console pull secret" for more information.
Additional resources
1.1.1. Setting up the MicroShift Kickstart file
To provision a host with a MicroShift Kickstart file, you can install the sample templates and set environment variables for pull secrets and user credentials.
You can use the Kickstart file provided with MicroShift to provision a host by following the instructions for your install type. The ISO you created in the previous steps then runs on the host that you provision with your Kickstart file.
Prerequisites
- The host you are provisioning must meet the system requirements for installing MicroShift.
-
A pull secret from
~/.pull-secret.jsonmust be present and have read permissions for the current user.
Procedure
Install the
microshift-release-infoRPM package containing the sample Kickstart files that are in the/usr/share/microshift/kickstartdirectory by running the following command:$ sudo dnf install -y microshift-release-info
Install the utilities used during the Kickstart file creation by running the following command:
$ sudo dnf install -y openssl gettext
Set the variables pointing to secrets included in
kickstart.ks.The
PULL_SECRETfile contents are copied to the/etc/crio/openshift-pull-secretdirectory at the post-installation stage to authenticate OpenShift Container Platform container registry access.Example command setting the
PULL_SECRETvariable:$ export PULL_SECRET="$(cat ~/.pull-secret.json)"
Set a password in the
PASSWD_TEXTvariable to use in the`USER_PASSWD` setting by running the following command:Example command setting the
PASSWD_TEXTvariable.$ PASSWD_TEXT=<redhat_user_plain_text_password>Replace <redhat_user_plain_text_password> with the password you want to use.
The
USER_PASSWDsetting is used as an encrypted password for theredhatuser for logging into the host. Encrypt your password string using the SHA-512 encryption standard.Example command setting the
USER_PASSWDvariable.$ export USER_PASSWD="$(openssl passwd -6 "${PASSWD_TEXT}")"In this example, only the encrypted password is included in the Kickstart file. The plain text password is not.
Next steps
- Follow the instructions for your installation type to create a working Kickstart file from the provided template. Instructions for RPM-based, RHEL for Edge, and image mode for RHEL installations follow this procedure.
- Optional. Create a virtual machine (VM) using the Kickstart file. You can use a VM to test and validate the values in your Kickstart file.
1.1.2. Creating a Kickstart file for a MicroShift RPM installation
You can use the Kickstart file provided with MicroShift to provision an RPM-based virtual machine.
Prerequisites
- You set up the MicroShift Kickstart file.
- You know the This content is not included.Activation Keys and organization ID to activate your Red Hat subscription.
-
You have the information needed to set the
BOOTC_IMAGE_URL,AUTH_CONFIG, andREGISTRY_CONFIGrequired variables.
The subscription must include access to the rhocp-4.x-for-rhel-9-$(uname -m)-rpms and fast-datapath-for-rhel-9-$(uname -m)-rpms RPM repositories.
Procedure
Add the following variables to create an RPM Kickstart file:
The
RHSM_ORGvariable contains a Red Hat Subscription Manager organization ID for the subscription registration command in the Kickstart file.$ export RHSM_ORG="$(cat ~/.rhsm-activation-org)"
The
RHSM_KEYvariable contains a Red Hat Subscription Manager activation key for the subscription registration command in the Kickstart file.$ export RHSM_KEY="$(cat ~/.rhsm-activation-key)"
The
MICROSHIFT_VERvariable references the MicroShift version to install using the4.yformat. The latest available.zversion of the4.yversion set in this variable is automatically installed.$ export MICROSHIFT_VER={product-version}In this example, the latest
.zof the minor version that you set is installed.
Run the following command to create the
kickstart.ksfile to be used during the virtual machine installation:envsubst < \ /usr/share/microshift/kickstart/kickstart-rpm.ks.template > \ "${HOME}/kickstart.ks"
1.1.3. Creating a Kickstart file for a MicroShift RHEL for Edge installation
You can use the Kickstart file provided with MicroShift to provision a RHEL for Edge-based virtual machine.
Prerequisites
- You set up the MicroShift Kickstart file.
- You have the information needed to set required and optional variables.
Procedure
Add the following required variables to create an RHEL for Edge Kickstart file:
The
OSTREE_SERVER_URLvariable contains anrpm-ostreeserver URL that is passed to theostreesetupKickstart command.$ export OSTREE_SERVER_URL="<http://my_ostree_server_url>"Replace Content from my_ostree_server_url is not included.http://my_ostree_server_url with your server URL.
The
OSTREE_COMMIT_REFvariable contains anrpm-ostreecommit reference that is installed from the server.$ export OSTREE_COMMIT_REF="<myostree_commit_reference>"Replace <myostree_commit_reference> with the
rpm-ostreecommit reference.
Optional. Add the following variable for server authentication:
The
AUTH_CONFIGcontents are copied to/etc/ostree/auth.jsonat the pre-install stage to authenticate access to theOSTREE_SERVER_URLserver. If no server authentication is required, skip this setting.$ export AUTH_CONFIG="$(cat ~/.ostree-auth.json)"
Run the following command to create the
kickstart.ksfile to be used during the installation:envsubst < \ /usr/share/microshift/kickstart/kickstart-ostree.ks.template > \ "${HOME}/kickstart.ks"NoteThe MicroShift version specified in the
rpm-ostreecommit is installed. To change the version of MicroShift, you must create a new commit.
1.1.4. Creating a Kickstart file for installing MicroShift on image mode for RHEL
You can use the Kickstart file provided with MicroShift for an image mode for RHEL installation.
Prerequisites
- You set up the MicroShift Kickstart file.
- You have the information needed to set required and optional variables.
Procedure
Set the required
BOOTC_IMAGE_URLvariable value to point to an image used in the RHEL Kickstart file installation process by running the following command:$ export BOOTC_IMAGE_URL=<myregistry>/<myorg>/<mypath>/microshift-image:tagReplace <myregistry>, <myorg>, and <mypath> with your information.
-
The
BOOTC_IMAGE_URLvariable contains a reference to the image that theostreecontainercommand installs. You can specify a z-stream release other than the latest by using the tag if required.
-
The
Optional. Add variables and values for registry authentication and configuration by using the following commands:
Set the
AUTH_CONFIGvariable to authenticate access to theBOOTC_IMAGE_URLimage by running the following command:$ export AUTH_CONFIG="$(cat ~/.quay-auth.json)"
In this example, see the
containers-auth.json(5)manual page for more information about this file format.Set the
REGISTRY_CONFIGvariable to configure access to the registry containing theBOOTC_IMAGE_URLimage by running the following command:$ export REGISTRY_CONFIG="$(cat ~/.quay-config.conf)"
In this example, see the
containers-registries.conf(5)manual page for more information about this file format.
Create the
kickstart.ksfile to be used during the installation by running the following command:envsubst < \ /usr/share/microshift/kickstart/kickstart-bootc.ks.template > \ "${HOME}/kickstart.ks"