第 6 章 将文件和对象存储添加到现有外部 OpenShift Data Foundation 集群
当 OpenShift Data Foundation 配置为外部模式时,可以通过多种方式为持久性卷声明和对象存储桶声明提供存储。
- 块存储的持久卷声明直接从外部 Red Hat Ceph Storage 集群提供。
- 文件存储的持久卷声明可以通过向外部 Red Hat Ceph Storage 添加元数据服务器(MDS)提供。
- 对象存储的对象 bucket 声明可以通过使用 Multicloud 对象网关或将 Ceph 对象网关添加到外部 Red Hat Ceph Storage 集群来提供。
使用以下流程,将文件存储(使用元数据服务器)或对象存储(使用 Ceph 对象网关)添加到最初部署为仅提供块存储的外部 OpenShift Data Foundation 集群。
先决条件
-
您已在 OpenShift Container Platform 版本 4.11 或更高版本上安装并运行 OpenShift Data Foundation 4.11。另外,处于外部模式的 OpenShift Data Foundation 集群处于
Ready
状态。 您的外部 Red Hat Ceph Storage 集群被配置为以下一个或多个集群:
- 一个 Ceph 对象网关(RGW)端点,可由 OpenShift Container Platform 集群访问以用于对象存储
- 用于文件存储的元数据服务器(MDS)池
-
确保您知道在外部 OpenShift Data Foundation 集群部署期间用于
ceph-external-cluster-details-exporter.py
脚本的参数。
流程
使用以下命令下载 OpenShift Data Foundation 的
ceph-external-cluster-details-exporter.py
python 脚本:oc get csv $(oc get csv -n openshift-storage | grep ocs-operator | awk '{print $1}') -n openshift-storage -o jsonpath='{.metadata.annotations.external\.features\.ocs\.openshift\.io/export-script}' | base64 --decode > ceph-external-cluster-details-exporter.py
通过在外部 Red Hat Ceph Storage 集群中的任何客户端节点上运行
ceph-external-cluster-details-exporter.py
,更新外部 Red Hat Ceph Storage 存储集群的权限上限。您可能需要要求您的 Red Hat Ceph Storage 管理员来执行此操作。# python3 ceph-external-cluster-details-exporter.py --upgrade \ --run-as-user=ocs-client-name \ --rgw-pool-prefix rgw-pool-prefix
--run-as-user
-
在 OpenShift Data Foundation 集群部署期间使用的客户端名称。如果未设置其他客户端名称,请使用默认的客户端名称
client.healthchecker
。 --rgw-pool-prefix
- 用于 Ceph 对象网关池的前缀。如果使用默认前缀,可以省略它。
从外部 Red Hat Ceph Storage 生成并保存配置详情。
通过在外部 Red Hat Ceph Storage 集群中的任何客户端节点上运行
ceph-external-cluster-details-exporter.py
生成配置详情。# python3 ceph-external-cluster-details-exporter.py --rbd-data-pool-name rbd-block-pool-name --monitoring-endpoint ceph-mgr-prometheus-exporter-endpoint --monitoring-endpoint-port ceph-mgr-prometheus-exporter-port --run-as-user ocs-client-name --rgw-endpoint rgw-endpoint --rgw-pool-prefix rgw-pool-prefix
--monitoring-endpoint
- 是可选的。它接受可从 OpenShift Container Platform 集群访问的活跃和待机 mgrs 的以逗号分隔的 IP 地址列表。如果没有提供,则会自动填充该值。
--monitoring-endpoint-port
-
是可选的。它是与
--monitoring-endpoint
指定的 ceph-mgr Prometheus exporter 关联的端口。如果没有提供,则会自动填充该值。 --run-as-user
- 在 OpenShift Data Foundation 集群部署期间使用的客户端名称。如果未设置其他客户端名称,请使用默认的客户端名称 client.healthchecker。
--rgw-endpoint
- 提供此参数,以通过 Ceph 对象网关为 OpenShift Data Foundation 置备对象存储(可选参数)
--rgw-pool-prefix
- 用于 Ceph 对象网关池的前缀。如果使用默认前缀,可以省略它。
用户权限已更新,如下所示:
caps: [mgr] allow command config caps: [mon] allow r, allow command quorum_status, allow command version caps: [osd] allow rwx pool=default.rgw.meta, allow r pool=.rgw.root, allow rw pool=default.rgw.control, allow rx pool=default.rgw.log, allow x pool=default.rgw.buckets.index
注意确保除 Ceph 对象网关详细信息(如果提供)之外的所有参数(包括可选参数)与在外部模式中部署 OpenShift Data Foundation 期间所用的相同。
将脚本的输出保存到
external-cluster-config.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>"}}]
上传生成的 JSON 文件。
- 登录 OpenShift Web 控制台。
-
点 Workloads
Secrets。 -
将 project 设置为
openshift-storage
。 - 点 rook-ceph-external-cluster-details。
-
点 Actions (⋮)
Edit Secret -
点 Browse 并上传
external-cluster-config.json
文件。 - 点击 Save。
验证步骤
要验证 OpenShift Data Foundation 集群是否健康,且数据具有弹性,请导航到 Storage
Data foundation Storage Systems 选项卡,然后点击存储系统名称。 -
在 Overview
Block and File 选项卡中,检查 Status 卡以确认存储集群有一个绿色勾号表示其健康。
-
在 Overview
如果您为文件存储添加了元数据服务器:
-
点 Workloads
Pods,验证 csi-cephfsplugin-*
pod 是否已创建新并处于 Running 状态。 -
点 Storage
Storage Classes 并验证是否已创建 ocs-external-storagecluster-cephfs
存储类。
-
点 Workloads
如果您为对象存储添加了 Ceph 对象网关:
-
点 Storage
Storage Classes 并验证是否已创建 ocs-external-storagecluster-ceph-rgw
存储类。 -
要验证 OpenShift Data Foundation 集群是否健康,且数据具有弹性,请导航到 Storage
Data foundation Storage Systems 选项卡,然后点击存储系统名称。 - 单击 Object 选项卡,并确认 Object Service 和数据弹性具有绿色勾号,指示其运行正常。
-
点 Storage