$ mkdir ibi-iso-workdir (1)
使用 `openshift-install` 程序为在裸机主机上预安装单节点 OpenShift 创建实时安装 ISO。有关下载安装程序的更多信息,请参阅“附加资源”部分中的“安装过程”。
安装程序采用种子镜像 URL 和其他输入(例如种子镜像的发行版本和用于安装过程的磁盘)并创建实时安装 ISO。然后,您可以使用实时安装 ISO 启动主机以开始预安装。预安装完成后,主机即可运送到远程站点进行最终的特定于站点的配置和部署。
以下是使用基于镜像的安装预安装单节点 OpenShift 集群的高级步骤
生成种子镜像。
使用 `openshift-install` 安装程序创建实时安装 ISO。
使用实时安装 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 ibi-iso-workdir (1)
1 | 将 `ibi-iso-workdir` 替换为您工作目录的名称。 |
可选。创建一个安装配置模板,在配置 `ImageBasedInstallationConfig` 资源时用作参考
$ openshift-install image-based create image-config-template --dir ibi-iso-workdir (1)
1 | 如果您未指定工作目录,则该命令将使用当前目录。 |
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.17.0
seedVersion: 4.17.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.17.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
作为基于映像的安装过程的一部分,安装 ISO 会为/var/lib/containers
目录创建一个分区。
您可以使用coreosInstallerArgs
规范创建附加分区。例如,对于具有足够存储空间的硬盘,您可能需要一个用于存储选项的附加分区,例如逻辑卷管理器 (LVM) 存储。
|
编辑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.17.0"
installationDisk: /dev/sda
pullSecret: '{"auths": ...}'
# ...
skipDiskCleanup: true (1)
coreosInstallerArgs:
- "--save-partindex" (2)
- "6" (3)
ignitionConfigOverride: |
{
"ignition": {
"version": "3.2.0"
},
"storage": {
"disks": [
{
"device": "/dev/sda", (4)
"partitions": [
{
"label": "storage", (5)
"number": 6, (6)
"sizeMiB": 380000, (7)
"startMiB": 500000 (8)
}
]
}
]
}
}
1 | 指定true 以跳过安装过程中的磁盘格式化。 |
2 | 指定此参数以保留分区。 |
3 | 实时安装 ISO 需要五个分区。指定大于五的数字以标识要保留的附加分区。 |
4 | 指定目标主机上的安装磁盘。 |
5 | 指定分区的标签。 |
6 | 指定分区的编号。 |
7 | 指定分区的 MiB 大小。 |
8 | 指定附加分区在磁盘上的起始位置 (MiB)。您必须指定一个大于var/lib/containers 分区的起始点。 |
使用实时安装 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
使用您首选的方法,从rhcos-ibi.iso
实时安装 ISO 引导目标裸机主机以预安装单节点 OpenShift。
登录到目标主机。
运行以下命令查看系统日志。
$ journalctl -b
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="All the precaching threads have finished."
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="Total Images: 125"
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="Images Pulled Successfully: 125"
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="Images Failed to Pull: 0"
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="Completed executing pre-caching"
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13T17:01:44Z" level=info msg="Pre-cached images successfully."
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13 17:01:44" level=info msg="Skipping shutdown"
Aug 13 17:01:44 10.46.26.129 install-rhcos-and-restore-seed.sh[2876]: time="2024-08-13 17:01:44" level=info msg="IBI preparation process finished successfully!"
Aug 13 17:01:44 10.46.26.129 systemd[1]: var-lib-containers-storage-overlay.mount: Deactivated successfully.
Aug 13 17:01:44 10.46.26.129 systemd[1]: Finished SNO Image-based Installation.
Aug 13 17:01:44 10.46.26.129 systemd[1]: Reached target Multi-User System.
Aug 13 17:01:44 10.46.26.129 systemd[1]: Reached target Graphical Interface.
image-based-installation-config.yaml
清单的参考规范以下内容描述了image-based-installation-config.yaml
清单的规范。
openshift-install
程序使用image-based-installation-config.yaml
清单为单节点 OpenShift 的基于映像的安装创建实时安装 ISO。
规范 | 类型 | 描述 |
---|---|---|
|
|
指定在 ISO 生成过程中使用的种子映像。 |
|
|
指定种子映像的 OpenShift Container Platform 发行版版本。种子映像中的发行版版本必须与您在 |
|
|
指定将用于安装过程的磁盘。 由于磁盘发现顺序并非保证,因此磁盘的内核名称在具有多个磁盘的机器的引导选项之间可能会发生变化。例如, |
|
|
指定在预缓存过程中使用的拉取密钥。拉取密钥包含从容器注册表拉取发行版有效负载映像的认证凭据。 如果种子映像需要单独的私有注册表身份验证,请将身份验证详细信息添加到拉取密钥。 |
规范 | 类型 | 描述 | ||
---|---|---|---|---|
|
|
指定安装过程完成后主机是否关闭。默认值为 |
||
|
|
指定用于 |
||
|
|
您用于
|
||
|
|
您用于 |
||
|
|
安装过程会格式化主机上的磁盘。将此规范设置为“true”以跳过此步骤。默认为 |
||
|
|
指定主机的网络配置,例如
如果需要静态网络,则必须在创建实时安装 ISO 的主机上安装
|
||
|
|
指定在安装 ISO 生成过程中使用的代理设置,例如
|
||
|
|
指定发行版映像内容的源或存储库,例如
|
||
|
|
指定 PEM 编码的 X.509 证书捆绑包。安装程序会将其添加到安装 ISO 中的
|
||
|
|
指定用于验证对主机的访问权限的 SSH 密钥。 |
||
|
|
指定包含用户对 Ignition 配置的覆盖的 JSON 字符串。该配置与安装程序生成的 Ignition 配置文件合并。此功能需要 Ignition 版本 3.2 或更高版本。 |
||
|
|
指定您可以用来配置内核参数和磁盘分区选项的 |