4.5. 配置 Reporting Operator

重要

Metering 是一个已弃用的功能。弃用的功能仍然包含在 OpenShift Container Platform 中,并将继续被支持。但是,这个功能会在以后的发行版本中被删除,且不建议在新的部署中使用。

有关 OpenShift Container Platform 中已弃用或删除的主要功能的最新列表,请参阅 OpenShift Container Platform 发行注记中已弃用和删除的功能部分。

Reporting Operator 负责从 Prometheus 中收集数据,存储指标数据至 Presto 中,对 Presto 运行报告查询,并通过 HTTP API 公开查询结果。配置 Reporting Operator 主要在您的 MeteringConfig 自定义资源中进行。

4.5.1. 保护 Prometheus 连接

在 OpenShift Container Platform 上安装 metering 时,使用 https://prometheus-k8s.openshift-monitoring.svc:9091/ 访问 Prometheus。

为保护与 Prometheus 的连接,默认 metering 安装使用 OpenShift Container Platform 证书颁发机构(CA)。如果您的 Prometheus 实例使用不同的 CA,您可以通过配置映射注入 CA。您还可以将 Reporting Operator 配置为使用指定的 bearer 令牌与 Prometheus 进行身份验证。

流程

  • 通过配置映射注入 Prometheus 实例使用的 CA。例如:

    spec:
      reporting-operator:
        spec:
          config:
            prometheus:
              certificateAuthority:
                useServiceAccountCA: false
                configMap:
                  enabled: true
                  create: true
                  name: reporting-operator-certificate-authority-config
                  filename: "internal-ca.crt"
                  value: |
                    -----BEGIN CERTIFICATE-----
                    (snip)
                    -----END CERTIFICATE-----

    另外,要使系统的 CA 可以支持公共的证书,请将 ServiceAccountCAconfigMap.enabled 设置为 false

  • 指定 bearer 令牌以通过 Prometheus 进行身份验证。例如:
spec:
  reporting-operator:
    spec:
      config:
        prometheus:
          metricsImporter:
            auth:
              useServiceAccountToken: false
              tokenSecret:
                enabled: true
                create: true
                value: "abc-123"