Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

4.12. 配置 Red Hat Gluster Storage Persistent Storage

Red Hat Gluster Storage 可以配置为为 OpenShift Container Platform 提供 持久性存储和动态置备。它可用于 OpenShift Container Platform 中容器化(聚合模式)和在其自身节点上的非容器化(独立模式)。

您可以使用变量配置 Red Hat Gluster Storage 集群,这些变量与 OpenShift Container Platform 集群交互。您在 [OSEv3:vars] 组中定义的变量包括主机变量、角色变量以及镜像名称和版本标签变量。

您可以使用 glusterfs_devices 主机变量定义块设备列表来管理 Red Hat Gluster Storage 集群。您配置中的每个主机必须至少有一个 glusterfs_devices 变量,对于每次配置来说,必须至少有一个裸机设备没有分区或 LVM PV。

角色变量控制将 Red Hat Gluster Storage 集群整合到新的或现有的 OpenShift Container Platform 集群。您可以定义多个角色变量,其中每个变量都有一个对应变量,可选择性配置一个独立的 Red Hat Gluster Storage 集群,用作集成 Docker registry 的存储。

您可以定义镜像名称和版本标签变量,以防止 OpenShift Container Platform pod 在中断后进行升级,这可能导致使用不同 OpenShift Container Platform 版本的集群。您还可以定义这些变量,以指定所有容器化组件的镜像名称和版本标签。

额外的信息和示例,包括以下信息及示例,可在 使用 Red Hat Gluster Storage 的持久性存储中找到。

4.12.1. 配置聚合模式

重要

如需具体主机的准备和先决条件,请参阅 聚合模式考虑

  1. 在清单文件的 [OSEv3:vars] 部分中包含以下变量,并根据您的配置需要调整它们:

    [OSEv3:vars]
    ...
    openshift_storage_glusterfs_namespace=app-storage
    openshift_storage_glusterfs_storageclass=true
    openshift_storage_glusterfs_storageclass_default=false
    openshift_storage_glusterfs_block_deploy=true
    openshift_storage_glusterfs_block_host_vol_size=100
    openshift_storage_glusterfs_block_storageclass=true
    openshift_storage_glusterfs_block_storageclass_default=false
  2. [OSEv3: Child] 部分添加 glusterfs 来启用 [glusterfs] 组:

    [OSEv3:children]
    masters
    nodes
    glusterfs
  3. 添加 [glusterfs] 部分,其中包含托管 GlusterFS 存储的每个存储节点的条目。对于每个节点,将 glusterfs_devices 设置为作为 GlusterFS 集群一部分完全管理的原始块设备列表。必须至少列出一个设备。每个设备都必须是空的,没有分区或 LVM PV。以以下形式指定变量:

    <hostname_or_ip> glusterfs_devices='[ "</path/to/device1/>", "</path/to/device2>", ... ]'

    例如:

    [glusterfs]
    node11.example.com glusterfs_devices='[ "/dev/xvdc", "/dev/xvdd" ]'
    node12.example.com glusterfs_devices='[ "/dev/xvdc", "/dev/xvdd" ]'
    node13.example.com glusterfs_devices='[ "/dev/xvdc", "/dev/xvdd" ]'
  4. [glusterfs] 下列出的主机添加到 [nodes] 组中:

    [nodes]
    ...
    node11.example.com openshift_node_group_name="node-config-compute"
    node12.example.com openshift_node_group_name="node-config-compute"
    node13.example.com openshift_node_group_name="node-config-compute"

为了使部署成功,需要有效的镜像标签。将 <tag> 替换为与 OpenShift Container Platform 3.11 兼容的 Red Hat Gluster Storage 版本,如清单文件中以下变量互操作性表格 中所述:

  • openshift_storage_glusterfs_image=registry.redhat.io/rhgs3/rhgs-server-rhel7:<tag>
  • openshift_storage_glusterfs_block_image=registry.redhat.io/rhgs3/rhgs-gluster-block-prov-rhel7:<tag>
  • openshift_storage_glusterfs_s3_image=registry.redhat.io/rhgs3/rhgs-s3-server-rhel7:<tag>
  • openshift_storage_glusterfs_heketi_image=registry.redhat.io/rhgs3/rhgs-volmanager-rhel7:<tag>
  • openshift_storage_glusterfs_registry_image=registry.redhat.io/rhgs3/rhgs-server-rhel7:<tag>
  • openshift_storage_glusterfs_block_registry_registry.redhat.io/rhgs3/rhgs-gluster-block-prov-rhel7:<tag>
  • openshift_storage_glusterfs_s3_registry_image=registry.redhat.io/rhgs3/rhgs-s3-server-rhel7:<tag>
  • openshift_storage_glusterfs_heketi_registry_image=registry.redhat.io/rhgs3/rhgs-volmanager-rhel7:<tag>