第 9 章 监控在 RHOSO 上运行的集群
您可以为在 OpenShift (RHOSO) 上运行的 Red Hat OpenStack Services 的集群关联可观察性指标。通过从这两个环境收集指标,您可以监控基础架构和应用程序层中的问题并进行故障排除。
对于在 RHOSO 上运行的集群,有两种支持的指标关联方法:
- 远程写入 外部 Prometheus 实例。
- 从 OpenShift Container Platform 联邦端点收集数据到 RHOSO 可观察性堆栈。
9.1. 远程写入外部 Prometheus 实例 复制链接链接已复制到粘贴板!
对 OpenShift (RHOSO) 和 OpenShift Container Platform 上的 Red Hat OpenStack Services 使用远程写入,将其指标推送到外部 Prometheus 实例。
先决条件
- 您可以访问外部 Prometheus 实例。
- 您有对 RHOSO 和集群的管理访问权限。
- 您有用于与 mTLS 的安全通信的证书。
- 您的 Prometheus 实例被配置为客户端 TLS 证书,并被设置为远程写入接收器。
- Cluster Observability Operator 安装在 RHOSO 集群中。
- RHOSO 集群的监控堆栈配置为收集您感兴趣的指标。
Telemetry 在 RHOSO 环境中被启用。
注意要验证 telemetry 服务是否正常运行,请输入以下命令:
oc -n openstack get monitoringstacks metric-storage -o yaml
$ oc -n openstack get monitoringstacks metric-storage -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow monitoringstacks
CRD 指示遥测是否已正确启用。
流程
配置 RHOSO 管理集群,将指标发送到 Prometheus:
输入以下命令在
openstack
命名空间中创建一个名为mtls-bundle
的 secret,该 secret 包含 HTTPS 客户端证书以向 Prometheus 进行身份验证:oc --namespace openstack \ create secret generic mtls-bundle \ --from-file=./ca.crt \ --from-file=osp-client.crt \ --from-file=osp-client.key
$ oc --namespace openstack \ create secret generic mtls-bundle \ --from-file=./ca.crt \ --from-file=osp-client.crt \ --from-file=osp-client.key
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,打开
controlplane
配置进行编辑:oc -n openstack edit openstackcontrolplane/controlplane
$ oc -n openstack edit openstackcontrolplane/controlplane
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 打开配置后,替换
.spec.telemetry.template.metricStorage
部分,以便 RHOSO 将指标发送到 Prometheus。例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
配置运行工作负载的租户集群,将指标发送到 Prometheus:
以 YAML 文件形式创建集群监控配置映射。映射必须包含远程写入配置和集群标识符。例如:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 设置保留周期。另外,因为外部收集,您可以减少本地指标的保留。
-
将配置映射保存为名为
cluster-monitoring-config.yaml
的文件。 输入以下命令在
openshift-monitoring
命名空间中创建一个名为mtls-bundle
的 secret,其中包含用于向 Prometheus 进行身份验证的 HTTPS 客户端证书:oc --namespace openshift-monitoring \ create secret generic mtls-bundle \ --from-file=./ca.crt \ --from-file=ocp-client.crt \ --from-file=ocp-client.key
$ oc --namespace openshift-monitoring \ create secret generic mtls-bundle \ --from-file=./ca.crt \ --from-file=ocp-client.crt \ --from-file=ocp-client.key
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令来应用集群监控配置:
oc apply -f cluster-monitoring-config.yaml
$ oc apply -f cluster-monitoring-config.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
传播更改后,您可以在外部 Prometheus 实例中看到聚合的指标。