7.6. 使用 OpenStackControlPlane 创建 control plane
overcloud 控制平面包含管理 overcloud 功能的主要 Red Hat OpenStack Platform 服务。control plane 通常由 3 个 Controller 节点组成,并可扩展到其他基于 control plane 的可组合角色。当您使用可组合角色时,每个服务必须正好在 3 个额外的专用节点上运行,control plane 中的节点总数必须是奇数才能维护 Pacemaker 仲裁。
OpenStackControlPlane 自定义资源创建基于 control plane 的节点,作为 OpenShift Virtualization 中的虚拟机。
前提条件
- 确保 OpenShift Container Platform 集群正常运行,并且已正确安装了 director Operator。
-
确保已在工作站上安装了
oc命令行工具。 - 使用 OpenStackNetConfig 资源来创建 control plane 网络和任何其他隔离网络。
流程
在 workstation 上创建一个名为
openstack-controller.yaml的文件。包括 Controller 节点的资源规格。例如,由 3 个 Controller 节点组成的 control plane 规格如下:apiVersion: osp-director.openstack.org/v1beta2 kind: OpenStackControlPlane metadata: name: overcloud namespace: openstack spec: openStackClientNetworks: - ctlplane - internal_api - external openStackClientStorageClass: host-nfs-storageclass passwordSecret: userpassword virtualMachineRoles: Controller: roleName: Controller roleCount: 3 networks: - ctlplane - internal_api - external - tenant - storage - storage_mgmt cores: 12 memory: 64 rootDisk: diskSize: 500 baseImageVolumeName: openstack-base-img # storageClass must support RWX to be able to live migrate VMs storageClass: host-nfs-storageclass storageAccessMode: ReadWriteMany # When using OpenShift Virtualization with OpenShift Container Platform Container Storage, # specify RBD block mode persistent volume claims (PVCs) when creating virtual machine disks. # With virtual machine disks, RBD block mode volumes are more efficient and provide better # performance than Ceph FS or RBD filesystem-mode PVCs. # To specify RBD block mode PVCs, use the 'ocs-storagecluster-ceph-rbd' storage class and # VolumeMode: Block. storageVolumeMode: Filesystem # optional configure additional discs to be attached to the VMs, # need to be configured manually inside the VMs where to be used. additionalDisks: - name: datadisk diskSize: 500 storageClass: host-nfs-storageclass storageAccessMode: ReadWriteMany storageVolumeMode: Filesystem openStackRelease: "16.2"在资源规格中设置以下值:
metadata.name-
将 设置为 overcloud control plane 的名称,即
overcloud。 metadata.namespace-
设置为 director Operator 命名空间,它是
openstack。 spec设置 control plane 的配置。有关本节中可以使用的值的描述,请查看
openstackcontrolplaneCRD 的自定义资源定义中的规格模式:$ oc describe crd openstackcontrolplane
配置 control plane 规格后保存文件。
创建 control plane:
$ oc create -f openstack-controller.yaml -n openstack等待 OCP 创建与 OpenStackControlPlane 资源相关的资源。
作为 OpenStackControlPlane 资源的一部分,director Operator 还会创建一个 OpenStackClient pod,您可以通过远程 shell 访问并运行 RHOSP 命令。
验证
查看 control plane 的资源:
$ oc get openstackcontrolplane/overcloud -n openstack查看 OpenStackVMSet 资源,以验证创建 control plane 虚拟机集:
$ oc get openstackvmsets -n openstack查看虚拟机资源以验证 OpenShift Virtualization 中创建 control plane 虚拟机:
$ oc get virtualmachines测试对
openstackclient远程 shell 的访问:$ oc rsh -n openstack openstackclient