17.3. Preinstalling single-node OpenShift using an image-based installation
Use the openshift-install program to create a live installation ISO for preinstalling single-node OpenShift on bare-metal hosts. For more information about downloading the installation program, see "Installation process" in the "Additional resources" section.
The installation program takes a seed image URL and other inputs, such as the release version of the seed image and the disk to use for the installation process, and creates a live installation ISO. You can then start the host using the live installation ISO to begin preinstallation. When preinstallation is complete, the host is ready to ship to a remote site for the final site-specific configuration and deployment.
The following are the high-level steps to preinstall a single-node OpenShift cluster using an image-based installation:
- Generate a seed image.
-
Create a live installation ISO using the
openshift-installinstallation program. - Boot the host using the live installation ISO to preinstall the host.
You can embed your single-node OpenShift seed image URL, and other installation artifacts, in a live installation ISO by using the openshift-install program.
For more information about the specification for the image-based-installation-config.yaml manifest, see the section "Reference specifications for the image-based-installation-config.yaml manifest".
Prerequisites
- You generated a seed image from a single-node OpenShift seed cluster.
-
You downloaded the
openshift-installprogram. The version of theopenshift-installprogram must match the OpenShift Container Platform version in your seed image. - The target host has network access to the seed image URL and all other installation artifacts.
-
If you require static networking, you must install the
nmstatectllibrary on the host that creates the live installation ISO.
Procedure
Create a live installation ISO and embed your single-node OpenShift seed image URL and other installation artifacts:
Create a working directory by running the following:
$ mkdir <working_directory>where
<working_directory>is the name of your working directory, for exampleibi-iso-workdir.Optional. Create an installation configuration template to use as a reference when configuring the
ImageBasedInstallationConfigresource:$ openshift-install image-based create image-config-template --dir <working_directory>where
<working_directory>is the name of your working directory, for exampleibi-iso-workdir. If you do not specify a working directory, the command uses the current directory.Example output:
INFO Image-Config-Template created in: ibi-iso-workdir
+ The command creates the image-based-installation-config.yaml installation configuration template in your target directory:
+
#
# Note: This is a sample ImageBasedInstallationConfig file showing
# which fields are available to aid you in creating your
# own image-based-installation-config.yaml file.
#
apiVersion: v1beta1
kind: ImageBasedInstallationConfig
metadata:
name: example-image-based-installation-config
# The following fields are required
seedImage: quay.io/openshift-kni/seed-image:4.22.0
seedVersion: 4.22.0
installationDisk: /dev/vda
pullSecret: '<your_pull_secret>'
# networkConfig is optional and contains the network configuration for the host in NMState format.
# See https://nmstate.io/examples.html for examples.
# networkConfig:
# interfaces:
# - name: eth0
# type: ethernet
# state: up
# mac-address: 00:00:00:00:00:00
# ipv4:
# enabled: true
# address:
# - ip: 192.168.122.2
# prefix-length: 23
# dhcp: false
Edit your installation configuration file:
Example
image-based-installation-config.yamlfile:
apiVersion: v1beta1
kind: ImageBasedInstallationConfig
metadata:
name: example-image-based-installation-config
seedImage: quay.io/repo-id/seed:latest
seedVersion: "4.22.0"
extraPartitionStart: "-240G"
installationDisk: /dev/disk/by-id/wwn-0x62c...
sshKey: 'ssh-ed25519 AAAA...'
pullSecret: '{"auths": ...}'
networkConfig:
interfaces:
- name: ens1f0
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
auto-dns: false
address:
- ip: 192.168.200.25
prefix-length: 24
ipv6:
enabled: false
dns-resolver:
config:
server:
- 192.168.15.47
- 192.168.15.48
routes:
config:
- destination: 0.0.0.0/0
metric: 150
next-hop-address: 192.168.200.254
next-hop-interface: ens1f0
Create the live installation ISO by running the following command:
$ openshift-install image-based create image --dir ibi-iso-workdirExample output:
INFO Consuming Image-based Installation ISO Config from target directory
INFO Creating Image-based Installation ISO with embedded ignition
Verification
View the output in the working directory:
ibi-iso-workdir/ └── rhcos-ibi.iso
The installation ISO creates a partition for the /var/lib/containers directory as part of the image-based installation process.
You can create additional partitions by using the coreosInstallerArgs specification. For example, in hard disks with adequate storage, you might need an additional partition for storage options, such as Logical Volume Manager (LVM) Storage.
The /var/lib/containers partition requires at least 500 GB to ensure adequate disk space for precached images. You must create additional partitions with a starting position larger than the partition for /var/lib/containers.
Procedure
Edit the
image-based-installation-config.yamlfile to configure additional partitions:Example
image-based-installation-config.yamlfile:
apiVersion: v1beta1
kind: ImageBasedInstallationConfig
metadata:
name: example-extra-partition
seedImage: quay.io/repo-id/seed:latest
seedVersion: "4.22.0"
installationDisk: /dev/sda
pullSecret: '{"auths": ...}'
# ...
skipDiskCleanup: <skip_disk_cleanup>
coreosInstallerArgs:
- "--save-partindex"
- "<partition_index>"
ignitionConfigOverride: |
{
"ignition": {
"version": "3.2.0"
},
"storage": {
"disks": [
{
"device": "<installation_disk>",
"partitions": [
{
"label": "<partition_label>",
"number": <partition_number>,
"sizeMiB": <partition_size>,
"startMiB": <starting_position>
}
]
}
]
}
}
+ where:
+ <skip_disk_cleanup>:: Specifies whether to skip disk formatting during the installation process. Set to true to skip. "--save-partindex":: Specifies the argument to preserve a partition. <partition_index>:: Specifies the additional partition to preserve. The live installation ISO requires five partitions. Set a number greater than five, for example 6. <installation_disk>:: Specifies the installation disk on the target host, for example /dev/sda. <partition_label>:: Specifies the label for the partition, for example storage. <partition_number>:: Specifies the number for the partition, for example 6. <partition_size>:: Specifies the size of partition in MiB, for example 380000. <starting_position>:: Specifies the starting position on the disk in MiB for the additional partition. You must specify a starting point larger than the partition for /var/lib/containers, for example 500000.
Verification
When you complete the preinstallation of the host with the live installation ISO, login to the target host and run the following command to view the partitions:
$ lsblkExample output:
sda 8:0 0 140G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 127M 0 part
├─sda3 8:3 0 384M 0 part /var/mnt/boot
├─sda4 8:4 0 120G 0 part /var/mnt
├─sda5 8:5 0 500G 0 part /var/lib/containers
└─sda6 8:6 0 380G 0 part