|
| 1 | +The kickstart template files in this directory can be used for installing |
| 2 | +a host running MicroShift. |
| 3 | + |
| 4 | +## Procedure Overview |
| 5 | + |
| 6 | +* Start by configuring the [Prerequisites](#prerequisites). |
| 7 | +* Depending on the desired installation type, follow the instructions from one of |
| 8 | + the [RPM](#RPM), [Image Mode](#image-mode) or [OSTree](#OSTree) sections to |
| 9 | + create a working kickstart file from a template. |
| 10 | +* Create a virtual machine using the kickstart file from the previous step as |
| 11 | + described in [Create Virtual Machine](#create-virtual-machine) |
| 12 | + |
| 13 | + |
| 14 | +## Prepare Kickstart File |
| 15 | + |
| 16 | +### Prerequisites |
| 17 | + |
| 18 | +Install the `microshift-release-info` RPM package containing the sample kickstart |
| 19 | +files that are copied to the `/usr/share/microshift/kickstart` directory. |
| 20 | + |
| 21 | +```bash |
| 22 | +sudo dnf install -y microshift-release-info |
| 23 | +``` |
| 24 | + |
| 25 | +Install the utilities used during the kickstart file creation. |
| 26 | + |
| 27 | +```bash |
| 28 | +sudo dnf install -y openssl gettext |
| 29 | +``` |
| 30 | + |
| 31 | +Set variables pointing to secrets included in `kickstart.ks`. |
| 32 | + |
| 33 | +* `PULL_SECRET` file contents are copied to `/etc/crio/openshift-pull-secret` |
| 34 | + at the post-install stage to authenticate OpenShift container registry access. |
| 35 | +* `USER_PASSWD` setting is used as an encrypted password for the `redhat` user |
| 36 | + for logging into the host. |
| 37 | + |
| 38 | +Example commands setting the variables. |
| 39 | + |
| 40 | +```bash |
| 41 | +export PULL_SECRET="$(cat ~/.pull-secret.json)" |
| 42 | +# Only the encrypted password will be included in kickstart |
| 43 | +PASSWD_TEXT=<my_redhat_user_plain_text_password> |
| 44 | +export USER_PASSWD="$(openssl passwd -6 "${PASSWD_TEXT}")" |
| 45 | +``` |
| 46 | + |
| 47 | +### RPM |
| 48 | + |
| 49 | +The following variables need to be added for creating an RPM kickstart file. |
| 50 | +The activation keys and organization ID can be obtained at the [Activation Keys](https://console.redhat.com/insights/connector/activation-keys) site. |
| 51 | +They will be used for activating the Red Hat subscription during the installation. |
| 52 | + |
| 53 | +> The subscription must include access to the `rhocp-4.x-for-rhel-9-$(uname -m)-rpms` |
| 54 | +> and `fast-datapath-for-rhel-9-$(uname -m)-rpms` RPM repositories. |
| 55 | +
|
| 56 | +* `RHSM_ORG` contains an RHSM organization ID for the subscription registration |
| 57 | + command in kickstart. |
| 58 | +* `RHSM_KEY` contains an RHSM activation key for the subscription registration |
| 59 | + command in kickstart. |
| 60 | +* `MICROSHIFT_VER` references the MicroShift version to install using the `4.y` |
| 61 | + format. Note that the latest available `.z` version will be installed. |
| 62 | + |
| 63 | +Example commands setting the variables. |
| 64 | + |
| 65 | +```bash |
| 66 | +export RHSM_ORG="$(cat ~/.rhsm-activation-org)" |
| 67 | +export RHSM_KEY="$(cat ~/.rhsm-activation-key)" |
| 68 | +export MICROSHIFT_VER=4.17 |
| 69 | +``` |
| 70 | + |
| 71 | +Run the following command to create the `kickstart.ks` file to be used during |
| 72 | +the virtual machine installation. |
| 73 | + |
| 74 | +```bash |
| 75 | +envsubst < \ |
| 76 | + /usr/share/microshift/kickstart/kickstart-rpm.ks.template > \ |
| 77 | + "${HOME}/kickstart.ks" |
| 78 | +``` |
| 79 | + |
| 80 | +### Image Mode |
| 81 | + |
| 82 | +The following variables need to be added for creating an Image Mode kickstart file. |
| 83 | + |
| 84 | +* `BOOTC_IMAGE_URL` contains a reference to the image to be installed using the |
| 85 | + [ostreecontainer](https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#ostreecontainer) kickstart command. |
| 86 | +* `AUTH_CONFIG` contents are copied to `/etc/ostree/auth.json` to authenticate |
| 87 | + access to the `BOOTC_IMAGE_URL` image. If no registry authentication is required, |
| 88 | + skip this setting. |
| 89 | +* `REGISTRY_CONFIG` contents are copied to `/etc/containers/registries.conf.d/999-microshift-registry.conf` |
| 90 | + to configure access to the registry containing the `BOOTC_IMAGE_URL` image. |
| 91 | + If no registry configuration is required, skip this setting. |
| 92 | + |
| 93 | +Example commands setting the variables. |
| 94 | + |
| 95 | +```bash |
| 96 | +export BOOTC_IMAGE_URL=quay.io/myorg/mypath/microshift-image:tag |
| 97 | +export AUTH_CONFIG="$(cat ~/.quay-auth.json)" |
| 98 | +export REGISTRY_CONFIG="$(cat ~/.quay-config.conf)" |
| 99 | +``` |
| 100 | + |
| 101 | +Run the following command to create the `kickstart.ks` file to be used during |
| 102 | +the virtual machine installation. |
| 103 | + |
| 104 | +```bash |
| 105 | +envsubst < \ |
| 106 | + /usr/share/microshift/kickstart/kickstart-bootc.ks.template > \ |
| 107 | + "${HOME}/kickstart.ks" |
| 108 | +``` |
| 109 | + |
| 110 | +### OSTree |
| 111 | + |
| 112 | +The following variables need to be added for creating an OSTree kickstart file. |
| 113 | + |
| 114 | +* `OSTREE_SERVER_URL` contains an OSTree server URL passed to the |
| 115 | + [ostreesetup](https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#ostreesetup) kickstart command. |
| 116 | +* `OSTREE_COMMIT_REF` contains an OSTree commit reference to be installed from |
| 117 | + the server. |
| 118 | +* `AUTH_CONFIG` contents are copied to `/etc/ostree/auth.json` at the pre-install |
| 119 | + stage to authenticate access to the `OSTREE_SERVER_URL` server. If no server |
| 120 | + authentication is required, skip this setting. |
| 121 | + |
| 122 | +Example commands setting the variables. |
| 123 | + |
| 124 | +```bash |
| 125 | +export OSTREE_SERVER_URL="<http://my_ostree_server_url>" |
| 126 | +export OSTREE_COMMIT_REF="myostree_commit_reference" |
| 127 | +export AUTH_CONFIG="$(cat ~/.ostree-auth.json)" |
| 128 | +``` |
| 129 | + |
| 130 | +Run the following command to create the `kickstart.ks` file to be used during |
| 131 | +the virtual machine installation. |
| 132 | + |
| 133 | +```bash |
| 134 | +envsubst < \ |
| 135 | + /usr/share/microshift/kickstart/kickstart-ostree.ks.template > \ |
| 136 | + "${HOME}/kickstart.ks" |
| 137 | +``` |
| 138 | + |
| 139 | +## Create Virtual Machine |
| 140 | + |
| 141 | +Download a RHEL boot ISO image from https://developers.redhat.com/products/rhel/download. |
| 142 | +Copy the downloaded file to the `/var/lib/libvirt/images` directory. |
| 143 | + |
| 144 | +Run the following commands to create a RHEL virtual machine with 2 cores, 2GB of |
| 145 | +RAM and 20GB of storage. The command uses the kickstart file prepared in the |
| 146 | +previous steps to install the RHEL operating system and MicroShift. |
| 147 | + |
| 148 | +```bash |
| 149 | +VMNAME=microshift-host |
| 150 | +NETNAME=default |
| 151 | + |
| 152 | +sudo virt-install \ |
| 153 | + --name ${VMNAME} \ |
| 154 | + --vcpus 2 \ |
| 155 | + --memory 2048 \ |
| 156 | + --disk path=/var/lib/libvirt/images/${VMNAME}.qcow2,size=20 \ |
| 157 | + --network network=${NETNAME},model=virtio \ |
| 158 | + --events on_reboot=restart \ |
| 159 | + --location /var/lib/libvirt/images/rhel-9.4-$(uname -m)-boot.iso \ |
| 160 | + --initrd-inject "${HOME}/kickstart.ks" \ |
| 161 | + --extra-args "inst.ks=file://kickstart.ks" \ |
| 162 | + --wait |
| 163 | +``` |
| 164 | + |
| 165 | +Log into the virtual machine using the `redhat:<password>` credentials. |
| 166 | +Run the following command to verify that all the MicroShift pods are up and running |
| 167 | +without errors. |
| 168 | + |
| 169 | +```bash |
| 170 | +watch sudo oc get pods -A \ |
| 171 | + --kubeconfig /var/lib/microshift/resources/kubeadmin/kubeconfig |
| 172 | +``` |
0 commit comments