Chapter 1. Using Kickstart files for installing MicroShift in RHEL
Chapter 1. Using Kickstart files for installing MicroShift in RHEL Use a Kickstart file that automates the installation of an RHEL image with MicroShift. 1.1. Kickstart files for embedding MicroShift with a RHEL installation 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-secret and have root user-only read/write permissions. 1.1.1. Setting up the MicroShift Kickstart file 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 steps then runs on the host that you provision with your Kickstart file. To get started with the MicroShift Kickstart file, begin with the following procedure. Prerequisites The host you are provisioning must meet the system requirements for installing MicroShift. A pull secret from ~/.pull-secret.json must be present and have read permissions for the current user. Procedure Install the microshift-release-info RPM package containing the sample Kickstart files that are in the /usr/share/microshift/kickstart directory by running the following command: USD sudo dnf install -y microshift-release-info Install the utilities used during the Kickstart file creation by running the following command: USD sudo dnf install -y openssl gettext Set the variables pointing to secrets included in kickstart.ks . The PULL_SECRET file contents are copied to the /etc/crio/openshift-pull-secret directory at the post-installation stage to authenticate OpenShift Container Platform container registry access. Example command setting the PULL_SECRET variable: USD export PULL_SECRET="USD(cat ~/.pull-secret.json)" Set a password in the PASSWD_TEXT variable to use in the`USER_PASSWD` setting by running the following command: Example command setting the PASSWD_TEXT variable. USD PASSWD_TEXT=<my_redhat_user_plain_text_password> 1 1 Replace <my_redhat_user_plain_text_password> with the password you want to use. The USER_PASSWD setting is used as an encrypted password for the redhat user for logging into the host. Encrypt your password string using the SHA-512 encryption standard. Example command setting the USER_PASSWD variable. USD export USER_PASSWD="USD(openssl passwd -6 "USD{PASSWD_TEXT}")" 1 1 Only the encrypted password is included in the Kickstart file. The plain text password is not. 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. Creating a VM allows you to test and validate the values in your Kickstart file. 1.1.2. Creating a Kickstart file for a MicroShift RPM installation 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 [Activation Keys]( https://console.redhat.com/insights/connector/activation-keys ) and organization ID to activate your Red Hat subscription. You have the information needed to set the BOOTC_IMAGE_URL , AUTH_CONFIG , and REGISTRY_CONFIG variables. Important The subscription must include access to the rhocp-4.x-for-rhel-9-USD(uname -m)-rpms and fast-datapath-for-rhel-9-USD(uname -m)-rpms RPM repositories. Procedure Add the following variables to create an RPM Kickstart file: Example commands setting the Kickstart file variables. The RHSM_ORG variable contains a Red Hat Subscription Manager organization ID for the subscription registration command in the Kickstart file. USD export RHSM_ORG="USD(cat ~/.rhsm-activation-org)" The RHSM_KEY variable contains a Red Hat Subscription Manager activation key for the subscription registration command in the Kickstart file. USD export RHSM_KEY="USD(cat ~/.rhsm-activation-key)" The MICROSHIFT_VER variable references the MicroShift version to install using the 4.y format. The latest available .z version of the 4.y version set in this variable is automatically installed. USD export MICROSHIFT_VER=4.17 1 1 For the minor version you set, the latest z-stream of that version is installed. Run the following command to create the kickstart.ks file to be used during the virtual machine installation: envsubst < \ /usr/share/microshift/kickstart/kickstart-rpm.ks.template > \ "USD{HOME}/kickstart.ks" 1.1.3. Creating a Kickstart file for a MicroShift RHEL for Edge installation 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: Example commands setting required variables. The OSTREE_SERVER_URL variable contains an rpm-ostree server URL that is passed to the ostreesetup Kickstart command. USD export OSTREE_SERVER_URL="<http://my_ostree_server_url>" 1 1 Replace http://my_ostree_server_url with your server URL. The OSTREE_COMMIT_REF variable contains an rpm-ostree commit reference that is installed from the server. USD export OSTREE_COMMIT_REF="<myostree_commit_reference>" 1 1 Replace <myostree_commit_reference> with the rpm-ostree commit reference. Optional. Add the following variable for server authentication: The AUTH_CONFIG contents are copied to /etc/ostree/auth.json at the pre-install stage to authenticate access to the OSTREE_SERVER_URL server. If no server authentication is required, skip this setting. USD export AUTH_CONFIG="USD(cat ~/.ostree-auth.json)" Run the following command to create the kickstart.ks file to be used during the installation: envsubst < \ /usr/share/microshift/kickstart/kickstart-ostree.ks.template > \ "USD{HOME}/kickstart.ks" Note The MicroShift version specified in the rpm-ostree commit 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_URL variable value to point to an image used in the RHEL Kickstart file installation process by running the following command: USD export BOOTC_IMAGE_URL=<myregistry>/<myorg>/<mypath>/microshift-image:tag 1 1 Replace <myregistry> , <myorg> , and <mypath> with your information. The BOOTC_IMAGE_URL variable contains a reference to the image that is installed with the ostreecontainer command. You can specify a z-stream release other than the latest by using the tag if required. Optional. Add variables and values for registry authentication and configuration by using the following commands: Example commands setting optional variables Set the AUTH_CONFIG variable to authenticate access to the BOOTC_IMAGE_URL image by running the following command: USD export AUTH_CONFIG="USD(cat ~/.quay-auth.json)" 1 1 See the containers-auth.json(5) manual page for more information about this file format. Set the REGISTRY_CONFIG variable to configure access to the registry containing the BOOTC_IMAGE_URL image by running the following command: USD export REGISTRY_CONFIG="USD(cat ~/.quay-config.conf)" 1 1 See the containers-registries.conf(5) manual page for more information about this file format. Create the kickstart.ks file to be used during the installation by running the following command: envsubst < \ /usr/share/microshift/kickstart/kickstart-bootc.ks.template > \ "USD{HOME}/kickstart.ks"
sudo dnf install -y microshift-release-info sudo dnf install -y openssl gettext export PULL_SECRET="USD(cat ~/.pull-secret.json)" PASSWD_TEXT=<my_redhat_user_plain_text_password> 1 export USER_PASSWD="USD(openssl passwd -6 "USD{PASSWD_TEXT}")" 1 export RHSM_ORG="USD(cat ~/.rhsm-activation-org)" export RHSM_KEY="USD(cat ~/.rhsm-activation-key)" export MICROSHIFT_VER=4.17 1 envsubst < /usr/share/microshift/kickstart/kickstart-rpm.ks.template > "USD{HOME}/kickstart.ks" export OSTREE_SERVER_URL="<http://my_ostree_server_url>" 1 export OSTREE_COMMIT_REF="<myostree_commit_reference>" 1 export AUTH_CONFIG="USD(cat ~/.ostree-auth.json)" envsubst < /usr/share/microshift/kickstart/kickstart-ostree.ks.template > "USD{HOME}/kickstart.ks" export BOOTC_IMAGE_URL=<myregistry>/<myorg>/<mypath>/microshift-image:tag 1 export AUTH_CONFIG="USD(cat ~/.quay-auth.json)" 1 export REGISTRY_CONFIG="USD(cat ~/.quay-config.conf)" 1 envsubst < /usr/share/microshift/kickstart/kickstart-bootc.ks.template > "USD{HOME}/kickstart.ks"