15.2.6. vCenter 要求

在使用安装程序置备的基础架构的 vCenter 上安装 OpenShift Container Platform 集群前,您必须准备自己的环境。

所需的 vCenter 帐户权限

要在 vCenter 中安装 OpenShift Container Platform 集群,安装程序需要一个具有特权的帐户来读取和创建所需资源。使用具有全局管理特权的帐户是访问所有必要权限的最简单方式。

如果无法使用具有全局管理特权的帐户,您必须创建角色来授予 OpenShift Container Platform 集群安装所需的权限。虽然大多数权限始终是必需的,但是一些权限只有在计划安装程序需要在您的 vCenter 实例中置备一个包含 OpenShift Container Platform 集群的文件夹时(这是默认行为)才需要。您必须为指定对象创建或修改 vSphere 角色,才能授予所需的权限。

如果安装程序创建 vSphere 虚拟机文件夹,则需要额外的角色。

例 15.3. 安装所需的角色和权限

角色的 vSphere 对象何时需要所需的权限

vSphere vCenter

Always

Cns.Searchable
InventoryService.Tagging.AttachTag
InventoryService.Tagging.CreateCategory
InventoryService.Tagging.CreateTag
InventoryService.Tagging.DeleteCategory
InventoryService.Tagging.DeleteTag
InventoryService.Tagging.EditCategory
InventoryService.Tagging.EditTag
Sessions.ValidateSession
StorageProfile.View

vSphere vCenter Cluster

Always

Host.Config.Storage
Resource.AssignVMToPool
VApp.AssignResourcePool
VApp.Import
VirtualMachine.Config.AddNewDisk

vSphere Datastore

Always

Datastore.AllocateSpace
Datastore.Browse
Datastore.FileManagement

vSphere 端口组

Always

Network.Assign

虚拟机文件夹

Always

InventoryService.Tagging.ObjectAttachable
Resource.AssignVMToPool
VApp.Import
VirtualMachine.Config.AddExistingDisk
VirtualMachine.Config.AddNewDisk
VirtualMachine.Config.AddRemoveDevice
VirtualMachine.Config.AdvancedConfig
VirtualMachine.Config.Annotation
VirtualMachine.Config.CPUCount
VirtualMachine.Config.DiskExtend
VirtualMachine.Config.DiskLease
VirtualMachine.Config.EditDevice
VirtualMachine.Config.Memory
VirtualMachine.Config. RemoveDisk
VirtualMachine.Config.Rename
VirtualMachine.Config.ResetGuestInfo
VirtualMachine.Config.Resource
VirtualMachine.Config.Settings
VirtualMachine.Config.UpgradeVirtualHardware
VirtualMachine.Interact.Gu estControl
VirtualMachine.Interact.PowerOff
VirtualMachine.Interact.PowerOn
VirtualMachine.Interact.Reset
VirtualMachine.Inventory.Create
VirtualMachine.Inventory.CreateFromExisting
VirtualMachine.Inventory.Delete
VirtualMachine.Provisioning.Clone

vSphere vCenter Datacenter

如果安装程序创建虚拟机文件夹

InventoryService.Tagging.ObjectAttachable
Resource.AssignVMToPool
VApp.Import
VirtualMachine.Config.AddExistingDisk
VirtualMachine.Config.AddNewDisk
VirtualMachine.Config.AddRemoveDevice
VirtualMachine.Config.AdvancedConfig
VirtualMachine.Config.Annotation
VirtualMachine.Config.CPUCount
VirtualMachine.Config.DiskExtend
VirtualMachine.Config.DiskLease
VirtualMachine.Config.EditDevice
VirtualMachine.Config.Memory
VirtualMachine.Config. RemoveDisk
VirtualMachine.Config.Rename
VirtualMachine.Config.ResetGuestInfo
VirtualMachine.Config.Resource
VirtualMachine.Config.Settings
VirtualMachine.Config.UpgradeVirtualHardware
VirtualMachine.Interact.Gu estControl
VirtualMachine.Interact.PowerOff
VirtualMachine.Interact.PowerOn
VirtualMachine.Interact.Reset
VirtualMachine.Inventory.Create
VirtualMachine.Inventory.CreateFromExisting
VirtualMachine.Inventory.Delete
VirtualMachine.Provisioning.Clone
Folder.Create
Folder.Delete

此外,用户需要一些 ReadOnly 权限,某些角色需要权限来提升对子对象的权限。这些设置会根据您是否将集群安装到现有文件夹而有所不同。

例 15.4. 所需的权限和传播设置

vSphere 对象文件夹类型传播到子对象所需的权限

vSphere vCenter

Always

False

列出所需的权限

vSphere vCenter Datacenter

现有文件夹

False

ReadOnly 权限

安装程序创建文件夹

True

列出所需的权限

vSphere vCenter Cluster

Always

True

列出所需的权限

vSphere vCenter Datastore

Always

False

列出所需的权限

vSphere Switch

Always

False

ReadOnly 权限

vSphere 端口组

Always

False

列出所需的权限

vSphere vCenter Virtual Machine Folder

现有文件夹

True

列出所需的权限

有关只使用所需权限创建帐户的更多信息,请参阅 vSphere 文档中的 vSphere 权限和用户管理任务

将 OpenShift Container Platform 与 vMotion 搭配使用

如果要在 vSphere 环境中使用 vMotion,请在安装 OpenShift Container Platform 集群前考虑以下内容。

  • OpenShift Container Platform 通常支持仅用于计算的 vMotion。使用 Storage vMotion 可能会导致问题且不被支持。

    为了帮助确保计算和 control plane 节点的正常运行时间,建议您遵循 VMware 最佳实践进行 vMotion。还建议使用 VMware 反关联性规则来改进 OpenShift Container Platform 在维护或硬件问题期间的可用性。

    有关 vMotion 和 anti-affinity 规则的更多信息,请参阅 VMware vSphere 文档 了解 vMotion 网络要求和虚拟机反关联性规则

  • 如果您在 pod 中使用 vSphere 卷,请手动或通过 Storage vMotion 在数据存储间迁移虚拟机,从而导致 OpenShift Container Platform 持久性卷(PV)对象中的无效引用。这些引用可防止受影响的 pod 启动,并可能导致数据丢失。
  • 同样,OpenShift Container Platform 不支持在数据存储间有选择地迁移 VMDK、使用数据存储集群进行虚拟机置备、动态或静态置备 PV,或使用作为数据存储集群一部分的数据存储进行 PV 的动态或静态置备。
集群资源

当部署使用安装程序置备的基础架构的 OpenShift Container Platform 集群时,安装程序必须能够在 vCenter 实例中创建多个资源。

标准 OpenShift Container Platform 安装会创建以下 vCenter 资源:

  • 1 个文件夹
  • 1 标签(Tag)类别
  • 1 个标签(Tag)
  • 虚拟机:

    • 1 个模板
    • 1 个临时 bootstrap 节点
    • 3 个 control plane 节点
    • 3 个计算机器

虽然这些资源使用了 856 GB 存储,但 bootstrap 节点会在集群安装过程中被销毁。使用标准集群至少需要 800 GB 存储。

如果部署了更多计算机器,OpenShift Container Platform 集群将使用更多存储。

集群的限制

可用资源因集群而异。vCenter 中可能的集群数量主要受可用存储空间以及对所需资源数量的限制。确保考虑集群创建的 vCenter 资源的限制和部署集群所需的资源,如 IP 地址和网络。

网络要求

网络必须使用 DHCP,并确保 DHCP 服务器被配置为为集群机器提供持久的 IP 地址。所有节点都必须位于同一 VLAN。您不能将第二个 VLAN 来扩展集群作为第 2 天操作。另外,在安装 OpenShift Container Platform 集群前,必须创建以下网络资源:

注意

建议集群中的每个 OpenShift Container Platform 节点都可以访问可通过 DHCP 发现的网络时间协议(NTP)服务器。没有 NTP 服务器也可安装。但是,异步服务器时钟将导致错误,NTP 服务器会阻止。

所需的 IP 地址

安装程序置备的 vSphere 安装需要两个静态 IP 地址:

  • API 地址用于访问集群 API。
  • Ingress 地址用于集群入口流量。

安装 OpenShift Container Platform 集群时,必须向安装程序提供这些 IP 地址。

DNS 记录

您必须在正确的 DNS 服务器中为托管 OpenShift Container Platform 集群的 vCenter 实例创建两个静态 IP 地址的 DNS 记录。在每个记录中,<cluster_name> 是集群名称,<base_domain> 是您在安装集群时指定的集群基域。完整的 DNS 记录采用如下格式: <component>.<cluster_name>.<base_domain>.

表 15.10. 所需的 DNS 记录

组件记录描述

API VIP

api.<cluster_name>.<base_domain>.

此 DNS A/AAAA 或 CNAME 记录必须指向 control plane 机器的负载均衡器。此记录必须能由集群外的客户端和集群内的所有节点解析。

Ingress VIP

*.apps.<cluster_name>.<base_domain>.

通配符 DNS A/AAAA 或 CNAME 记录,指向以运行入口路由器 Pod 的机器(默认为 worker 节点)为目标的负载均衡器。此记录必须能由集群外的客户端和集群内的所有节点解析。