17.3. イメージベースのインストールを使用したシングルノード OpenShift のプリインストール
openshift-install プログラムを使用して、ベアメタルホストにシングルノード OpenShift をプリインストールするためのライブインストール ISO を作成します。インストールプログラムのダウンロードの詳細は、「関連情報」セクションの「インストールプロセス」を参照してください。
インストールプログラムは、シードイメージの URL と、シードイメージのリリースバージョンやインストールプロセスに使用するディスクなどのその他の入力情報を受け取り、ライブインストール ISO を作成します。その後、ライブインストール ISO を使用してホストを起動し、プリインストールを開始できます。プリインストールが完了したら、最終的なサイト固有の設定とデプロイを行うために、ホストをリモートサイトに出荷できます。
以下は、イメージベースのインストールを使用してシングルノード OpenShift クラスターをプリインストールするための大まかな手順です。
- シードイメージを生成します。
-
openshift-installインストールプログラムを使用してライブインストール ISO を作成します。 - ライブインストール ISO を使用してホストを起動し、ホストをプリインストールします。
17.3.1. シングルノード OpenShift のイメージベースインストール用のライブインストール ISO を作成する リンクのコピーリンクがクリップボードにコピーされました!
openshift-install プログラムを使用して、シングルノード OpenShift のシードイメージの URL やその他のインストールアーティファクトをライブインストール ISO に埋め込むことができます。
image-based-installation-config.yaml マニフェストの仕様の詳細は、「image-based-installation-config.yaml マニフェストのリファレンス仕様」セクションを参照してください。
前提条件
- シングルノード OpenShift のシードクラスターからシードイメージを生成した。
-
openshift-installプログラムをダウンロードした。openshift-installプログラムのバージョンが、シードイメージ内の OpenShift Container Platform のバージョンと一致している。 - ターゲットホストが、シードイメージの URL と他のすべてのインストールアーティファクトにネットワークでアクセスできる。
-
静的ネットワークが必要な場合は、ライブインストール ISO を作成するホストに
nmstatectlライブラリーをインストールする必要があります。
手順
ライブインストール ISO を作成し、シングルノード OpenShift のシードイメージの URL とその他のインストールアーティファクトを埋め込みます。
次のコマンドを実行して作業ディレクトリーを作成します。
$ mkdir <working_directory>この場合の
<working_directory>は作業ディレクトリーの名前 (例:ibi-iso-workdir) です。オプション:
ImageBasedInstallationConfigリソースを設定するときにリファレンスとして使用するインストール設定テンプレートを作成します。$ openshift-install image-based create image-config-template --dir <working_directory>この場合の
<working_directory>は作業ディレクトリーの名前 (例:ibi-iso-workdir) です。作業ディレクトリーを指定しなかった場合、カレントディレクトリーが使用されます。出力例:
INFO Image-Config-Template created in: ibi-iso-workdir
+ このコマンドにより、ターゲットディレクトリーに image-based-installation-config.yaml インストール設定テンプレートが作成されます。
+
#
# 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.21.0
seedVersion: 4.21.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
インストール設定ファイルを編集します。
image-based-installation-config.yamlファイルの例:
apiVersion: v1beta1
kind: ImageBasedInstallationConfig
metadata:
name: example-image-based-installation-config
seedImage: quay.io/repo-id/seed:latest
seedVersion: "4.21.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
次のコマンドを実行してライブインストール ISO を作成します。
$ openshift-install image-based create image --dir ibi-iso-workdir出力例:
INFO Consuming Image-based Installation ISO Config from target directory
INFO Creating Image-based Installation ISO with embedded ignition
検証
作業ディレクトリーで出力を確認します。
ibi-iso-workdir/ └── rhcos-ibi.iso
17.3.1.1. ターゲットホスト上の追加パーティションの設定 リンクのコピーリンクがクリップボードにコピーされました!
インストール ISO は、イメージベースのインストールプロセス中に、/var/lib/containers ディレクトリーのパーティションを作成します。
coreosInstallerArgs 仕様を使用すると、追加のパーティションを作成できます。たとえば、十分なストレージ容量を備えたハードディスクに、論理ボリュームマネージャー (LVM) ストレージなどのストレージオプション用の追加パーティションが必要になる場合があります。
/var/lib/containers パーティションには、事前キャッシュされたイメージに十分なディスク領域を確保するために、少なくとも 500 GB が必要です。追加のパーティションを作成する際には、/var/lib/containers のパーティションよりも大きい開始位置を指定する必要があります。
手順
image-based-installation-config.yamlファイルを編集して、追加のパーティションを設定します。image-based-installation-config.yamlファイルの例:
apiVersion: v1beta1
kind: ImageBasedInstallationConfig
metadata:
name: example-extra-partition
seedImage: quay.io/repo-id/seed:latest
seedVersion: "4.21.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>
}
]
}
]
}
}
詳細は次のとおりです。
+ <skip_disk_cleanup>:: インストールプロセス中にディスクフォーマットをスキップするかどうかを指定します。スキップする場青は true に設定します。"--save-partindex":: パーティションを保存する引数を指定します。<partition_index>:: 保持する追加のパーティションを指定します。ライブインストール ISO には 5 つのパーティションが必要です。5 より大きい数値 (例: 6) を設定してください。<installation_disk>:: ターゲットホスト上のインストールディスク (例: /dev/sda) を指定します。<partition_label>:: パーティションのラベル (例: storage) を指定します。<partition_number>:: パーティションの番号 (例: 6) を指定します。<partition_size>:: パーティションのサイズを MiB 単位で指定します (例: 380000)。<starting_position>:: 追加パーティションのディスク上の開始位置を MiB 単位で指定します。/var/lib/containers のパーティションよりも大きい開始位置 (例: 500000) を指定する必要があります。
検証
ライブインストール ISO を使用したホストのプリインストールが完了したら、ターゲットホストにログインし、次のコマンドを実行してパーティションを表示します。
$ lsblk出力例:
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