第3章 仮想マシンでの bootc イメージの実行
起動可能なコンテナーイメージをインストールソースとして使用して、Red Hat Enterprise Linux (RHEL) 仮想マシンをセットアップします。
3.1. キックスタートファイルの作成 リンクのコピーリンクがクリップボードにコピーされました!
インストール時に使用するキックスタートファイルを作成する必要があります。
前提条件
- root ユーザーアクセス権がある。
- 物理ハイパーバイザーホストにログインしている。
手順
次のコマンドを実行して、
kickstart.ksファイル内のシークレットファイルを参照して、プライベートコンテナーレジストリーアクセスを認証するようにAUTH_CONFIG環境変数を設定します。$ AUTH_CONFIG=~/.quay-auth.json次のコマンドを実行して、
PULL_SECRET環境変数を設定してkickstart.ksファイル内のシークレットファイルを参照し、OpenShift Container Platform レジストリーアクセスを認証します。$ PULL_SECRET=~/.pull-secret.json以下のコマンドを実行して、インストール時に使用するコンテナーイメージのイメージモードを参照する
IMAGE_REF環境変数を設定します。$ IMAGE_REF="quay.io/<myorg>/<mypath>/microshift-4.19-bootc"1 - 1
- <myorg/mypath> は、リモートレジストリーの組織名とパスに置き換えます。
次のスクリプトを実行して、インストール中に使用する
kickstart.ksファイルを作成します。$ cat > kickstart.ks <<EOFKS lang en_US.UTF-8 keyboard us timezone UTC text reboot # Partition the disk with hardware-specific boot and swap partitions, adding an # LVM volume that contains a 10GB+ system root. The remainder of the volume will # be used by the CSI driver for storing data. zerombr clearpart --all --initlabel # Create boot and swap partitions as required by the current hardware platform reqpart --add-boot # Add an LVM volume group and allocate a system root logical volume part pv.01 --grow volgroup rhel pv.01 logvol / --vgname=rhel --fstype=xfs --size=10240 --name=root # Lock root user account rootpw --lock # Configure network to use DHCP and activate on boot network --bootproto=dhcp --device=link --activate --onboot=on %pre-install --log=/dev/console --erroronfail # Create a 'bootc' image registry authentication file mkdir -p /etc/ostree cat > /etc/ostree/auth.json <<'EOF' $(cat "${AUTH_CONFIG}") EOF %end # Pull a 'bootc' image from a remote registry ostreecontainer --url "${IMAGE_REF}" %post --log=/dev/console --erroronfail # Create an OpenShift pull secret file cat > /etc/crio/openshift-pull-secret <<'EOF' $(cat "${PULL_SECRET}") EOF chmod 600 /etc/crio/openshift-pull-secret %end EOFKS