2.2. 为外部 Ceph 存储系统创建 OpenShift Data Foundation 集群


在 VMware vSphere 或用户置备的裸机基础架构上部署的 OpenShift Container Platform 上安装 OpenShift Data Foundation operator 后,需要创建新的 OpenShift Data Foundation 集群。

先决条件

流程

  1. 在 OpenShift Web 控制台中,点击 Storage Data Foundation Storage Systems Create StorageSystem
  2. 在 Backing storage 页面中,选择以下选项:

    1. Deployment 类型选项选择 Full Deployment
    2. 从可用选项中选择 Connect a external storage platform
    3. Storage platform 选择 Red Hat Ceph Storage
    4. Next
  3. 在连接详情页面中,提供必要的信息:

    1. 在 Connect to external cluster 部分中,点 Download Script 链接,以下载用于提取 Ceph 集群详细信息的 python 脚本。
    2. 要提取 Red Hat Ceph Storage (RHCS) 集群详情,请联系 RHCS 管理员,以在带有 admin 密钥 的 Red Hat Ceph Storage 节点上运行下载的 python 脚本。

      1. 在 RHCS 节点上运行以下命令查看可用参数列表:

        # python3 ceph-external-cluster-details-exporter.py --help
        重要

        如果在 Red Hat Enterprise Linux 7.x (RHEL 7.x) 集群中部署了 Red Hat Ceph Storage 4.x 集群,则使用 python 而不是 python3

        您也可以从 MON 容器(容器化部署)或 MON 节点(RPM 部署)运行脚本。

        注意

        使用 yum install cephadm 命令,然后运行 cephadm 命令,使用容器部署 RHCS 集群。您必须使用 cephadm 命令拉取 RHCS 容器镜像,而不是使用 yum 将 Ceph 软件包安装到节点上。如需更多信息,请参阅 RHCS 产品文档

      2. 要从 RHCS 集群检索外部集群详情,请选择以下两个选项之一,可以是配置文件或命令行标志。

        1. 配置文件

          使用 config-file 标志。这会存储部署期间使用的参数。

          在新部署中,您可以将部署期间使用的参数保存到配置文件中。然后,可以在升级过程中使用此文件来保留参数并添加任何其他参数。使用 config-file 设置配置文件的路径。

          保存在 /config.ini 中的配置文件示例:

          [Configurations]
          format = bash
          cephfs-filesystem-name = <filesystem-name>
          rbd-data-pool-name = <pool_name>
          ...

          使用 config-file 设置 config.ini 文件的路径:

          # python3 ceph-external-cluster-details-exporter.py --config-file /config.ini
        2. 命令行标记

          从 RHCS 集群检索外部集群详情,并传递部署的参数。

          # python3 ceph-external-cluster-details-exporter.py \
          --rbd-data-pool-name <rbd block pool name>  [optional arguments]

          例如:

          # python3 ceph-external-cluster-details-exporter.py --rbd-data-pool-name ceph-rbd --monitoring-endpoint xxx.xxx.xxx.xxx --monitoring-endpoint-port xxxx --rgw-endpoint xxx.xxx.xxx.xxx:xxxx --run-as-user client.ocs

          RBD 参数

          rbd-data-pool-name
          用于在 OpenShift Data Foundation 中提供块存储的必填参数。
          rados-namespace
          将 RBD 数据池划分为单独的逻辑命名空间,用于在 radosNamespace 中创建 RBD PVC。rados-namespace 所需的标记是 restricted-auth-permissionk8s-cluster-name
          rbd-metadata-ec-pool-name
          (可选)纠删代码 RBD 元数据池的名称。

          RGW 参数

          rgw-endpoint

          (可选)只有在 OpenShift Data Foundation 的 Ceph Rados 网关置备了对象存储时,才需要此参数。使用以下格式提供端点:<ip_address>:<port>

          注意

          完全限定域名 (FQDN) 也支持 <FQDN>:<PORT> 格式。

          rgw-pool-prefix
          (可选) RGW 池的前缀。如果未指定,默认的前缀为 default
          rgw-tls-cert-path

          (可选)RADOS 网关端点 TLS 证书的文件路径。

          • 要为 helper 脚本 ceph-external-cluster-details-exporter.py 提供 TLS 证书和 RGW 端点详情,请运行以下命令:

            # python3 ceph-external-clustergw-endpoint r-details-exporter.py --rbd-data-pool-name <rbd block pool name> --rgw-endpoint <ip_address>:<port> --rgw-tls-cert-path <file path containing cert>

            这会创建一个资源来创建 Ceph Object Store CR,如包含 TLS 证书的 Kubernetes secret。所有包括私钥的中间证书都需要存储在证书文件中。

          rgw-skip-tls
          (可选)此参数在提供自签名证书时忽略 TLS 证书验证(不推荐)。

          监控参数

          monitoring-endpoint
          (可选)此参数接受从 OpenShift Container Platform 集群访问的活跃和待机 mgrs 的 IP 地址的逗号分隔列表。如果没有提供,则会自动填充该值。
          monitoring-endpoint-port
          (可选)它是与 --monitoring-endpoint 指定的 ceph-mgr Prometheus exporter 关联的端口。如果没有提供,则会自动填充该值。

          Ceph 参数

          ceph-conf
          (可选)Ceph 配置文件的名称。
          run-as-user

          (可选)此参数用于为脚本创建的 Ceph 用户提供名称。如果没有指定此参数,则会创建一个默认的用户名 client.healthchecker。新用户的权限被设置为:

          • caps: [mgr] allow command config
          • caps: [mon] allow r, allow command quorum_status, allow command version
          • caps: [osd] allow rwx pool=RGW_POOL_PREFIX.rgw.meta, allow r pool=.rgw.root, allow rw pool=RGW_POOL_PREFIX.rgw.control, allow rx pool=RGW_POOL_PREFIX.rgw.log, allow x pool=RGW_POOL_PREFIX.rgw.buckets.index

          CephFS 参数

          cephfs-metadata-pool-name
          (可选)CephFS 元数据池的名称。
          cephfs-data-pool-name
          (可选)CephFS 数据池的名称。
          cephfs-filesystem-name
          (可选)CephFS 文件的名称。

          输出参数

          dry-run
          (可选)此参数会打印已执行命令的输出而不实际运行它们。
          output
          (可选)需要存储输出的文件。

          多集群参数

          k8s-cluster-name
          (可选)Kubernetes 集群名称。
          cluster-name
          (可选)Ceph 集群名称。
          restricted-auth-permission
          (可选)此参数将 cephCSIKeyrings auth 权限限制为特定的池和集群。需要与此一起设置的强制标记是 rbd-data-pool-namecluster-name。如果 CephFS 用户有限制,您也可以通过 cephfs-filesystem-name 标志,以便权限仅限于特定的 CephFS 文件系统。
          注意

          此参数必须只应用于新部署。要限制每个池和每个集群的 csi-users,您需要为这些 csi-users 创建新的 csi-users 和新的 secret。

          带有受限身份验证权限的示例:

          # python3 /etc/ceph/create-external-cluster-resources.py --cephfs-filesystem-name myfs --rbd-data-pool-name replicapool --cluster-name rookStorage --restricted-auth-permission true

          使用 python 脚本生成的 JSON 输出示例:

          [{"name": "rook-ceph-mon-endpoints", "kind": "ConfigMap", "data": {"data": "xxx.xxx.xxx.xxx:xxxx", "maxMonId": "0", "mapping": "{}"}}, {"name": "rook-ceph-mon", "kind": "Secret", "data": {"admin-secret": "admin-secret", "fsid": "<fs-id>", "mon-secret": "mon-secret"}}, {"name": "rook-ceph-operator-creds", "kind": "Secret", "data": {"userID": "<user-id>", "userKey": "<user-key>"}}, {"name": "rook-csi-rbd-node", "kind": "Secret", "data": {"userID": "csi-rbd-node", "userKey": "<user-key>"}}, {"name": "ceph-rbd", "kind": "StorageClass", "data": {"pool": "<pool>"}}, {"name": "monitoring-endpoint", "kind": "CephCluster", "data": {"MonitoringEndpoint": "xxx.xxx.xxx.xxx", "MonitoringPort": "xxxx"}}, {"name": "rook-ceph-dashboard-link", "kind": "Secret", "data": {"userID": "ceph-dashboard-link", "userKey": "<user-key>"}}, {"name": "rook-csi-rbd-provisioner", "kind": "Secret", "data": {"userID": "csi-rbd-provisioner", "userKey": "<user-key>"}}, {"name": "rook-csi-cephfs-provisioner", "kind": "Secret", "data": {"adminID": "csi-cephfs-provisioner", "adminKey": "<admin-key>"}}, {"name": "rook-csi-cephfs-node", "kind": "Secret", "data": {"adminID": "csi-cephfs-node", "adminKey": "<admin-key>"}}, {"name": "cephfs", "kind": "StorageClass", "data": {"fsName": "cephfs", "pool": "cephfs_data"}}, {"name": "ceph-rgw", "kind": "StorageClass", "data": {"endpoint": "xxx.xxx.xxx.xxx:xxxx", "poolPrefix": "default"}}, {"name": "rgw-admin-ops-user", "kind": "Secret", "data": {"accessKey": "<access-key>", "secretKey": "<secret-key>"}}]

      3. 将 JSON 输出保存到带有 .json 扩展名的文件

        注意

        要使 OpenShift Data Foundation 无缝工作,请确保使用 JSON 文件上传的参数(RGW 端点、CephFS 详细信息和 RBD 池等)在创建存储集群后在 RHCS 外部集群上保持不变。

      4. 在多租户部署中的 RHCS 集群已连接到带有较低版本的 OpenShift Data Foundation 部署时,运行命令。

        # python3 ceph-external-cluster-details-exporter.py --upgrade
    3. 单击 Browse 以选择并上传 JSON 文件。

      JSON 文件的内容填充并在文本框中显示。

    4. Next

      只有上传 .json 文件后,Next 按钮才会启用。

  4. 在 Review and create 页面中,检查所有详情是否正确:

    • 若要修改任何配置设置,请单击 Back 以返回到上一配置页面。
  5. 单击 Create StorageSystem

验证步骤

验证已安装存储集群的最终状态:

  1. 在 OpenShift Web 控制台中,导航到 Storage Data Foundation Storage System ocs-external-storagecluster
  2. 验证 StorageClusterStatus 是否为 Ready 且具有绿色勾号。
  3. 要验证 OpenShift Data Foundation、Pod 和 StorageClass 是否已成功安装,请参阅验证外部 Ceph 存储系统的 OpenShift Data Foundation 安装模式

2.2.1. 在 Red Hat Ceph Storage 集群中应用加密功能

流程

  1. 应用加密 in-transit 设置。

    root@ceph-client ~]# ceph config set global ms_client_mode secure
    [root@ceph-client ~]# ceph config set global ms_cluster_mode secure
    [root@ceph-client ~]# ceph config set global ms_service_mode secure
    [root@ceph-client ~]# ceph config set global rbd_default_map_options ms_mode=secure
  2. 检查设置。

    [root@ceph-client ~]# ceph config dump | grep ms_
    global                                       basic     ms_client_mode                         secure                                                                                                                                                                                                                                   *
    global                                       basic     ms_cluster_mode                        secure                                                                                                                                                                                                                                   *
    global                                       basic     ms_service_mode                        secure                                                                                                                                                                                                                                   *
    global                                       advanced  rbd_default_map_options                ms_mode=secure                                                                                                                                                                                                                           *
  3. 重新启动所有 Ceph 守护进程。

    [root@ceph-client ~]# ceph orch ps
    NAME                       HOST   PORTS             STATUS        REFRESHED  AGE  MEM USE  MEM LIM  VERSION           IMAGE ID      CONTAINER ID
    alertmanager.osd-0         osd-0  *:9093,9094       running (7h)     5m ago   7h    24.6M        -  0.24.0            3d2ad4f34549  6ef813aed5ef
    ceph-exporter.osd-0        osd-0                    running (7h)     5m ago   7h    17.7M        -  18.2.0-192.el9cp  6e4e34f038b9  179301cc7840
    ceph-exporter.osd-1        osd-1                    running (7h)     5m ago   7h    17.8M        -  18.2.0-192.el9cp  6e4e34f038b9  1084517c5d27
    ceph-exporter.osd-2        osd-2                    running (7h)     5m ago   7h    17.9M        -  18.2.0-192.el9cp  6e4e34f038b9  c933e31dc7b7
    ceph-exporter.osd-3        osd-3                    running (7h)     5m ago   7h    17.7M        -  18.2.0-192.el9cp  6e4e34f038b9  9981004a7169
    crash.osd-0                osd-0                    running (7h)     5m ago   7h    6895k        -  18.2.0-192.el9cp  6e4e34f038b9  9276199810a6
    crash.osd-1                osd-1                    running (7h)     5m ago   7h    6895k        -  18.2.0-192.el9cp  6e4e34f038b9  43aee09f1f00
    crash.osd-2                osd-2                    running (7h)     5m ago   7h    6903k        -  18.2.0-192.el9cp  6e4e34f038b9  adba2172546d
    crash.osd-3                osd-3                    running (7h)     5m ago   7h    6899k        -  18.2.0-192.el9cp  6e4e34f038b9  3a788ea496f3
    grafana.osd-0              osd-0  *:3000            running (7h)     5m ago   7h    65.5M        -  <unknown>         f142b583a1b1  c299328455cc
    mds.fsvol001.osd-0.lpciqk  osd-0                    running (7h)     5m ago   7h    24.8M        -  18.2.0-192.el9cp  6e4e34f038b9  8790381f177c
    mds.fsvol001.osd-2.wocnxz  osd-2                    running (7h)     5m ago   7h    32.1M        -  18.2.0-192.el9cp  6e4e34f038b9  2c66e36e19fc
    mgr.osd-0.dtkyni           osd-0  *:9283,8765,8443  running (7h)     5m ago   7h     535M        -  18.2.0-192.el9cp  6e4e34f038b9  41f5bed2d18a
    mgr.osd-2.kqcxwu           osd-2  *:8443,9283,8765  running (7h)     5m ago   7h     440M        -  18.2.0-192.el9cp  6e4e34f038b9  d8413a809b1f
    mon.osd-1                  osd-1                    running (7h)     5m ago   7h     350M    2048M  18.2.0-192.el9cp  6e4e34f038b9  fb3b5c186e38
    mon.osd-2                  osd-2                    running (7h)     5m ago   7h     363M    2048M  18.2.0-192.el9cp  6e4e34f038b9  f5314c164e89
    mon.osd-3                  osd-3                    running (7h)     5m ago   7h     361M    2048M  18.2.0-192.el9cp  6e4e34f038b9  3522f972ed7d
    node-exporter.osd-0        osd-0  *:9100            running (7h)     5m ago   7h    25.1M        -  1.4.0             508050f8c316  43845647bc06
    node-exporter.osd-1        osd-1  *:9100            running (7h)     5m ago   7h    21.4M        -  1.4.0             508050f8c316  e84c3e2206c9
    node-exporter.osd-2        osd-2  *:9100            running (7h)     5m ago   7h    25.4M        -  1.4.0             508050f8c316  071580052c80
    node-exporter.osd-3        osd-3  *:9100            running (7h)     5m ago   7h    21.8M        -  1.4.0             508050f8c316  317205f34647
    osd.0                      osd-2                    running (7h)     5m ago   7h     525M    4096M  18.2.0-192.el9cp  6e4e34f038b9  5247dd9d7ac3
    osd.1                      osd-0                    running (7h)     5m ago   7h     652M    4096M  18.2.0-192.el9cp  6e4e34f038b9  17c66fee9f13
    osd.2                      osd-3                    running (7h)     5m ago   7h     801M    1435M  18.2.0-192.el9cp  6e4e34f038b9  39b272b56fbe
    osd.3                      osd-1                    running (7h)     5m ago   7h     538M     923M  18.2.0-192.el9cp  6e4e34f038b9  f595858a1ca3
    osd.4                      osd-0                    running (7h)     5m ago   7h     532M    4096M  18.2.0-192.el9cp  6e4e34f038b9  c4f57cc9eda6
    osd.5                      osd-2                    running (7h)     5m ago   7h     761M    4096M  18.2.0-192.el9cp  6e4e34f038b9  d80ba180c940
    osd.6                      osd-3                    running (7h)     5m ago   7h     415M    1435M  18.2.0-192.el9cp  6e4e34f038b9  9ec319187e25
    osd.7                      osd-1                    running (7h)     5m ago   7h     427M     923M  18.2.0-192.el9cp  6e4e34f038b9  816731470d87
    prometheus.osd-0           osd-0  *:9095            running (7h)     5m ago   7h    84.0M        -  2.39.1            716dd9df3cf3  29db12cb1a5a
    rgw.rgw.ssl.osd-1.smzpfj   osd-1  *:80              running (7h)     5m ago   7h     110M        -  18.2.0-192.el9cp  6e4e34f038b9  57faaff4e425

    等待所有守护进程重启。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部