This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.11.7.12. 在 vSphere 中创建 Red Hat Enterprise Linux CoreOS (RHCOS) 机器
在 VMware vSphere 上安装包含用户置备基础架构的集群前,您必须在 vSphere 主机上创建 RHCOS 机器供其使用。
先决条件
- 已获取集群的 Ignition 配置文件。
- 您可以从计算机访问 HTTP 服务器,并且您创建的机器也可以访问该服务器。
- 您已创建了 vSphere 集群。
流程
-
将名为
<installation_directory>/bootstrap.ign
的 bootstrap Ignition 配置文件上传到 HTTP 服务器,该配置文件是由安装程序创建的。记下此文件的 URL。 将 bootstrap 节点的以下辅助 Ignition 配置文件保存到计算机中,存为
<installation_directory>/merge-bootstrap.ign
:{ "ignition": { "config": { "merge": [ { "source": "<bootstrap_ignition_config_url>", "verification": {} } ] }, "timeouts": {}, "version": "3.1.0" }, "networkd": {}, "passwd": {}, "storage": {}, "systemd": {} }
{ "ignition": { "config": { "merge": [ { "source": "<bootstrap_ignition_config_url>",
1 "verification": {} } ] }, "timeouts": {}, "version": "3.1.0" }, "networkd": {}, "passwd": {}, "storage": {}, "systemd": {} }
Copy to Clipboard Copied! - 1
- 指定您托管的 bootstrap Ignition 配置文件的 URL。
为 bootstrap 机器创建虚拟机 (VM) 时,您要使用此 Ignition 配置文件。
找到安装程序创建的以下 Ignition 配置文件:
-
<installation_directory>/master.ign
-
<installation_directory>/worker.ign
-
<installation_directory>/merge-bootstrap.ign
-
将 Ignition 配置文件转换为 Base64 编码。在此流程中,您必须将这些文件添加到虚拟机中的额外配置参数
guestinfo.ignition.config.data
中。例如,如果您使用 Linux 操作系统,可以使用
base64
命令来编码这些文件。base64 -w0 <installation_directory>/master.ign > <installation_directory>/master.64
$ base64 -w0 <installation_directory>/master.ign > <installation_directory>/master.64
Copy to Clipboard Copied! base64 -w0 <installation_directory>/worker.ign > <installation_directory>/worker.64
$ base64 -w0 <installation_directory>/worker.ign > <installation_directory>/worker.64
Copy to Clipboard Copied! base64 -w0 <installation_directory>/merge-bootstrap.ign > <installation_directory>/merge-bootstrap.64
$ base64 -w0 <installation_directory>/merge-bootstrap.ign > <installation_directory>/merge-bootstrap.64
Copy to Clipboard Copied! 重要如果您计划在安装完成后在集群中添加更多计算机器,请不要删除这些文件。
获取 RHCOS OVA 镜像。镜像位于 RHCOS 镜像镜像页面。
重要RHCOS 镜像可能不会随着 OpenShift Container Platform 的每一发行版本都有改变。您必须下载一个最高版本的镜像,其版本号应小于或等于您安装的 OpenShift Container Platform 版本。如果可用,请使用与 OpenShift Container Platform 版本匹配的镜像版本。
文件名包含 OpenShift Container Platform 版本号,格式为
rhcos-vmware.<architecture>.ova
。在 vSphere 客户端中,在数据中心中创建一个文件夹来存储您的虚拟机。
- 点击 VMs and Templates 视图。
- 右键点击您的数据中心名称。
-
点击 New Folder
New VM and Template Folder。 -
在显示的窗口中输入文件夹名称。如果您没有在
install-config.yaml
文件中指定现有文件夹,请创建一个文件夹,其名称与基础架构 ID 相同。您可以使用这个文件夹名称,因此 vCenter 会在适当的位置为 Workspace 配置动态置备存储。
在 vSphere 客户端中,为 OVA 镜像创建一个模板,然后根据需要克隆模板。
注意在以下步骤中,您将创建一个模板,然后克隆所有集群机器的模板。然后,在置备虚拟机时,为该克隆的机器类型提供 Ignition 配置文件的位置。
- 在 Hosts and Clusters 选项卡中,右键点击您的集群名称并选择 Deploy OVF Template。
- 在 Select an OVF 选项卡中,指定您下载的 RHCOS OVA 文件的名称。
-
在 Select a name and folder 选项卡中,为您的模板设置 虚拟机名称,如
Template-RHCOS
。点击 vSphere 集群的名称并选择您在上一步中创建的文件夹。 - 在 Select a compute resource 选项卡中,点击您的 vSphere 集群名称。
在 Select storage 选项卡中,配置虚拟机的存储选项。
- 根据您的存储要求,选择Thin Provision 或 Thick Provision。
-
选择您在
install-config.yaml
文件中指定的数据存储。
- 在 Select network 选项卡中,指定您为集群配置的网络(如果可用)。
在创建 OVF 模板时,请不要在 Customize template 选项卡上指定值,或者不要再配置模板。
重要不要启动原始虚拟机模板。VM 模板必须保持关闭状态,必须为新的 RHCOS 机器克隆。启动虚拟机模板会将虚拟机模板配置为平台上的虚拟机,这样可防止它被用作计算机集可以应用配置的模板。
部署模板后,为集群中的机器部署虚拟机。
-
右键点击模板的名称,再点击 Clone
Clone to Virtual Machine。 -
在 Select a name and folder 选项卡中,指定虚拟机的名称。名称中可以包括机器类型,如
control-plane-0
或compute-1
。 - 在 Select a name and folder 选项卡中,选择您为集群创建的文件夹名称。
在 Select a compute resource 选项卡中,选择数据中心中的主机名称。
对于 bootstrap 机器,指定您托管的 bootstrap Ignition 配置文件的 URL。
- 可选:在 Select storage 选项卡中,自定义存储选项。
- 在 Select clone options 中,选择 Customize this virtual machine’s hardware。
在 Customize hardware 选项卡中,点击 VM Options
Advanced。 可选:覆盖 vSphere 中的默认 DHCP 网络。启用静态 IP 网络:
设置静态 IP 配置:
export IPCFG="ip=<ip>::<gateway>:<netmask>:<hostname>:<iface>:none nameserver=srv1 [nameserver=srv2 [nameserver=srv3 [...]]]"
$ export IPCFG="ip=<ip>::<gateway>:<netmask>:<hostname>:<iface>:none nameserver=srv1 [nameserver=srv2 [nameserver=srv3 [...]]]"
Copy to Clipboard Copied! 示例命令
export IPCFG="ip=192.168.100.101::192.168.100.254:255.255.255.0:::none nameserver=8.8.8.8"
$ export IPCFG="ip=192.168.100.101::192.168.100.254:255.255.255.0:::none nameserver=8.8.8.8"
Copy to Clipboard Copied! 在从 vSphere 中的 OVA 引导虚拟机前,设置
guestinfo.afterburn.initrd.network-kargs
属性:govc vm.change -vm "<vm_name>" -e "guestinfo.afterburn.initrd.network-kargs=${IPCFG}"
$ govc vm.change -vm "<vm_name>" -e "guestinfo.afterburn.initrd.network-kargs=${IPCFG}"
Copy to Clipboard Copied!
可选:在出现集群性能问题时,从 Latency Sensitivity 列表中选择 High。确定虚拟机的 CPU 和内存保留有以下值:
- 内存保留值必须等于其配置的内存大小。
- CPU 保留值必须至少是低延迟虚拟 CPU 的数量,乘以测量的物理 CPU 速度。
点击 Edit Configuration,然后在 Configuration Parameters 窗口中点击 Add Configuration Params。定义以下参数名称和值:
-
guestinfo.ignition.config.data
:找到您在此流程中创建的 base-64 编码文件,并粘贴此机器类型的 base64 编码 Ignition 配置文件的内容。 -
guestinfo.ignition.config.data.encoding
:指定base64
。 -
disk.EnableUUID
:指定TRUE
。
-
- 在 Customize hardware 选项卡的 Virtual Hardware 面板中,根据需要修改指定的值。确保 RAM、CPU 和磁盘存储的数量满足机器类型的最低要求。
- 完成配置并打开虚拟机电源。
-
右键点击模板的名称,再点击 Clone
对于每台机器,按照前面的步骤为集群创建其余的机器。
重要此刻您必须创建 bootstrap 和 control plane 机器。由于计算机器中已默认部署了一些 Pod,因此在安装集群前,还要创建至少两台计算机器。