搜索

4.6. 使用 Insights Operator

download PDF

Insights Operator 会定期收集配置和组件故障状态信息,默每两小时向红帽报告这些数据。这些信息可让红帽评估配置,它提供了比 Telemetry 报告更深入的数据。OpenShift Container Platform 用户可以在 Red Hat Hybrid Cloud Console 上的 Insights Advisor 服务中显示报告。

其他资源

4.6.1. 配置 Insights Operator

Insights Operator 配置是默认 Operator 配置的组合,其配置存储在 openshift-insights 命名空间中的 insights-config ConfigMap 对象中,或者在 openshift-config 命名空间中的 support secret 中。

ConfigMap 对象或支持 secret 存在时,包含的属性值会覆盖默认的 Operator 配置值。如果 ConfigMap 对象 support secret 都存在,Operator 会读取 ConfigMap 对象。

ConfigMap 对象默认不存在,因此 OpenShift Container Platform 集群管理员必须创建它。

ConfigMap 对象配置结构

这个 insights-config ConfigMap 对象示例 (config.yaml 配置) 显示使用标准 YAML 格式的配置选项。

Insights Operator ConfigMap 对象示例

可配置属性和默认值

下表描述了可用的配置属性:

注意

insights-config ConfigMap 对象遵循标准 YAML 格式,其中子值位于父属性下,并缩进两个空格。对于 Obfuscation 属性,输入作为父属性的子属性。

表 4.1. Insights Operator 可配置的属性
属性名称描述值类型默认值

Obfuscation: - networking

启用 IP 地址和集群域名的全局模糊处理。

布尔值

false

obfuscation: - workload_names

如果安装了 Deployment Validation Operator,则模糊处理数据。

布尔值

false

sca: interval

指定简单内容访问权利下载的频率。

时间间隔

8h

sca: disabled

禁用简单内容访问权利下载。

布尔值

false

alerting: disabled

禁用集群 Prometheus 实例的 Insights Operator 警报。

布尔值

false

httpProxy, httpsProxy, noProxy

为 Insights Operator 设置自定义代理

URL

没有默认值

4.6.1.1. 创建 insights-config ConfigMap 对象

此流程描述了如何为 Insights Operator 创建 insights-config ConfigMap 对象来设置自定义配置。

重要

红帽建议您在更改默认 Insights Operator 配置前咨询红帽支持。

先决条件

  • 启用了远程健康报告(这是默认设置)。
  • 以具有 cluster-admin 角色的用户身份登录到 OpenShift Container Platform Web 控制台。

流程

  1. 进入 Workloads ConfigMaps 并选择 Project: openshift-insights
  2. Create ConfigMap
  3. 选择 Configure via: YAML view 并输入您的配置首选项,例如

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: insights-config
      namespace: openshift-insights
    data:
      config.yaml: |
        dataReporting:
          obfuscation:
            - networking
            - workload_names
        sca:
          disable: false
          interval: 2h
        alerting:
           disabled: false
    binaryData: {}
    immutable: false
  4. 可选: 选择 Form view 并输入所需信息。
  5. ConfigMap Name 字段中输入 insights-config
  6. Key 字段中,输入 config.yaml
  7. 对于 Value 字段,可以浏览文件以拖放到字段,或者手动输入您的配置参数。
  8. Create,您可以看到 ConfigMap 对象和配置信息。

4.6.2. 了解 Insights Operator 警报

Insights Operator 通过 Prometheus 监控系统向 Alertmanager 声明警报。您可以使用以下方法之一在 OpenShift Container Platform Web 控制台中的 Alerting UI 中查看这些警报:

  • Administrator 视角中,点 Observe Alerting
  • Developer 视角中,点 Observe <project_name> Alerts 标签页。

目前,Insights Operator 在满足条件时发送以下警报:

表 4.2. Insights Operator 警报
警报描述

InsightsDisabled

Insights Operator 被禁用。

SimpleContentAccessNotAvailable

Red Hat Subscription Management 中不启用简单的内容访问。

InsightsRecommendationActive

Insights 具有集群的活跃建议。

4.6.2.1. 禁用 Insights Operator 警报

要防止 Insights Operator 将警报发送到集群 Prometheus 实例,您可以创建或编辑 insights-config ConfigMap 对象。

注意

在以前的版本中,集群管理员会使用 openshift-config 命名空间中的 support secret 创建或编辑 Insights Operator 配置。Red Hat Insights 现在支持创建 ConfigMap 对象来配置 Operator。如果两者都存在,Operator 会优先选择支持 secret 的配置映射配置。

如果 insights-config ConfigMap 对象不存在,您必须首先添加自定义配置时创建它。请注意,ConfigMap 对象中的配置优先于 config/pod.yaml 文件中定义的默认设置。

先决条件

  • 启用了远程健康报告(这是默认设置)。
  • cluster-admin 用户身份登录到 OpenShift Container Platform Web 控制台。
  • insights-config ConfigMap 对象存在于 openshift-insights 命名空间中。

流程

  1. 进入 Workloads ConfigMaps 并选择 Project: openshift-insights
  2. insights-config ConfigMap 对象打开它。
  3. Actions 并选择 Edit ConfigMap
  4. YAML 视图 单选按钮。
  5. 在 文件中,将 alerting 属性设置为 disabled: true

    apiVersion: v1
    kind: ConfigMap
    # ...
    data:
      config.yaml: |
        alerting:
          disabled: true
    # ...
  6. 点击 Saveinsights-config config-map 详情页面将打开。
  7. 验证 config.yaml alerting 属性的值是否已设置为 disabled: true

保存更改后,Insights Operator 不再将警报发送到集群 Prometheus 实例。

4.6.2.2. 启用 Insights Operator 警报

禁用警报时,Insights Operator 不再将警报发送到集群 Prometheus 实例。您可以重新启用它们。

注意

在以前的版本中,集群管理员会使用 openshift-config 命名空间中的 support secret 创建或编辑 Insights Operator 配置。Red Hat Insights 现在支持创建 ConfigMap 对象来配置 Operator。如果两者都存在,Operator 会优先选择支持 secret 的配置映射配置。

先决条件

  • 启用了远程健康报告(这是默认设置)。
  • cluster-admin 用户身份登录到 OpenShift Container Platform Web 控制台。
  • insights-config ConfigMap 对象存在于 openshift-insights 命名空间中。

流程

  1. 进入 Workloads ConfigMaps 并选择 Project: openshift-insights
  2. insights-config ConfigMap 对象打开它。
  3. Actions 并选择 Edit ConfigMap
  4. YAML 视图 单选按钮。
  5. 在文件中,将 alerting 属性设置为 disabled: false

    apiVersion: v1
    kind: ConfigMap
    # ...
    data:
      config.yaml: |
        alerting:
          disabled: false
    # ...
  6. 点击 Saveinsights-config config-map 详情页面将打开。
  7. 验证 config.yaml alerting 属性的值是否已设置为 disabled: false

保存更改后,Insights Operator 会再次向集群 Prometheus 实例发送警报。

4.6.3. 下载 Insights Operator 存档

Insights Operator 将收集的数据存储在集群的 openshift-insights 命名空间中的存档中。您可以下载并查看 Insights Operator 收集的数据。

先决条件

  • 您可以使用具有 cluster-admin 角色的用户访问集群。

流程

  1. 为 Insights Operator 查找正在运行的 pod 的名称:

    $ oc get pods --namespace=openshift-insights -o custom-columns=:metadata.name --no-headers  --field-selector=status.phase=Running
  2. 复制 Insights Operator 收集的最近数据存档:

    $ oc cp openshift-insights/<insights_operator_pod_name>:/var/lib/insights-operator ./insights-data 1
    1
    <insights_operator_pod_name> 替换为上一命令中的 pod 名称输出。

Insights Operator 最近存档可在 insights-data 目录中找到。

4.6.4. 运行 Insights Operator 收集操作

您可以根据需要运行 Insights Operator 数据收集操作。以下流程描述了如何使用 OpenShift Web 控制台或 CLI 运行默认收集操作列表。您可以自定义 on demand gather 功能,以排除您选择的任何收集操作。禁用从默认列表中的收集操作降级 Insights Advisor 的功能,为集群提供有效的建议。如果您之前禁用了集群中的 Insights Operator 收集操作,这个过程将覆盖这些参数。

重要

DataGather 自定义资源只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。

有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围

注意

如果在集群中启用了技术预览,Insights Operator 会在单个 pod 中运行收集操作。这是 Insights Operator 的技术预览功能集的一部分,并支持新的数据收集功能。

4.6.4.1. 查看 Insights Operator 收集持续时间

您可以查看 Insights Operator 收集存档中包含的信息所使用的时间。这有助于您了解 Insights Operator 资源使用情况和 Insights Advisor 的问题。

先决条件

  • Insights Operator 归档的最新副本。

流程

  1. 在归档中,打开 /insights-operator/gathers.json

    文件包含 Insights Operator 收集操作列表:

        {
          "name": "clusterconfig/authentication",
          "duration_in_ms": 730, 1
          "records_count": 1,
          "errors": null,
          "panic": null
        }
    1
    duration_in_ms 是每个收集操作的时间(毫秒)。
  2. 检查每个收集操作是否有异常情况。

4.6.4.2. 使用 Web 控制台运行 Insights Operator 收集操作

您可以使用 OpenShift Container Platform Web 控制台运行 Insights Operator 收集操作。

先决条件

  • 以具有 cluster-admin 角色的用户身份登录到 OpenShift Container Platform Web 控制台。

流程

  1. 进入到 Administration CustomResourceDefinitions
  2. CustomResourceDefinitions 页面上,使用 Search by name 字段来查找 DataGather 资源定义并点它。
  3. CustomResourceDefinition 详情页面,点 Instances 选项卡。
  4. Create DataGather
  5. 要创建新的 DataGather 操作,请编辑配置文件:

    apiVersion: insights.openshift.io/v1alpha1
    kind: DataGather
    metadata:
      name: <your_data_gather> 1
    spec:
     gatherers: 2
       - name: workloads
         state: Disabled
    1
    <your_data_gather> 替换为收集操作的唯一名称。
    2
    输入单独的收集操作,以在 gatherers 参数下禁用。这个示例禁用 workloads 数据收集操作,并将运行默认操作的其余部分。要运行默认收集操作的完整列表,请将 spec 参数留空。您可以在 Insights Operator 文档中找到收集操作的完整列表。
  6. 点击 Save

验证

  1. 导航到 Workloads Pods
  2. 在 Pods 页面上,选择 Project 下拉菜单,然后打开 Show default projects。
  3. Project 下拉菜单中选择 openshift-insights 项目。
  4. 检查您的新收集操作是否已带有您在 openshift-insights 项目中的 pod 列表下选择的名称作为前缀。完成后,Insights Operator 会自动将数据上传到红帽进行处理。

4.6.4.3. 使用 OpenShift CLI 运行 Insights Operator 收集操作

您可以使用 OpenShift Container Platform 命令行界面运行 Insights Operator 收集操作。

先决条件

  • 以具有 cluster-admin 角色的用户身份登录到 OpenShift Container Platform。

流程

  • 输入以下命令运行 gather 操作:

    $ oc apply -f <your_datagather_definition>.yaml

    使用以下参数将 <your_datagather_definition>.yaml 替换为配置文件:

    apiVersion: insights.openshift.io/v1alpha1
    kind: DataGather
    metadata:
      name: <your_data_gather> 1
    spec:
     gatherers: 2
       - name: workloads
         state: Disabled
    1
    <your_data_gather> 替换为收集操作的唯一名称。
    2
    输入单独的收集操作,以在 gatherers 参数下禁用。这个示例禁用 workloads 数据收集操作,并将运行默认操作的其余部分。要运行默认收集操作的完整列表,请将 spec 参数留空。您可以在 Insights Operator 文档中找到收集操作的完整列表。

验证

  • 检查您的新收集操作是否已带有您在 openshift-insights 项目中的 pod 列表下选择的名称作为前缀。完成后,Insights Operator 会自动将数据上传到红帽进行处理。

4.6.4.4. 禁用 Insights Operator 收集操作

您可以禁用 Insights Operator 收集操作。禁用收集操作可让您提高机构的隐私,因为 Insights Operator 不再收集并向红帽发送 Insights 集群报告。这将禁用集群的 Insights 分析和建议,而不影响需要与红帽(如集群传输)进行通信的其他核心功能。您可以从 Insights Operator 归档中的 /insights-operator/gathers.json 文件中查看集群收集操作的尝试列表。请注意,只有满足特定条件且没有出现在您最近的归档中时,才会进行一些收集操作。

重要

InsightsDataGather 自定义资源只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。

有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围

注意

如果在集群中启用了技术预览,Insights Operator 会在单个 pod 中运行收集操作。这是 Insights Operator 的技术预览功能集的一部分,并支持新的数据收集功能。

先决条件

  • 以具有 cluster-admin 角色的用户身份登录到 OpenShift Container Platform Web 控制台。

流程

  1. 进入到 Administration CustomResourceDefinitions
  2. CustomResourceDefinitions 页面上,使用 Search by name 字段来查找 InsightsDataGather 资源定义并点它。
  3. CustomResourceDefinition 详情页面,点 Instances 选项卡。
  4. cluster,然后点 YAML 选项卡。
  5. 通过对 InsightsDataGather 配置文件执行以下编辑之一来禁用收集操作:

    1. 要禁用所有收集操作,请在 disabledGatherers 键下输入 all

      apiVersion: config.openshift.io/v1alpha1
      kind: InsightsDataGather
      metadata:
      ....
      
      spec: 1
        gatherConfig:
          disabledGatherers:
            - all 2
      1
      spec 参数指定收集配置。
      2
      all 值禁用所有收集操作。
    2. 要禁用单个收集操作,请在 disabledGatherers 键下输入它们的值:

      spec:
        gatherConfig:
          disabledGatherers:
            - clusterconfig/container_images 1
            - clusterconfig/host_subnets
            - workloads/workload_info
      1
      单个收集操作示例
  6. 点击 Save

    保存更改后,Insights Operator 收集配置会更新,操作将不再发生。

注意

禁用收集操作降级 Insights Advisor 的功能,可为您的集群提供有效的建议。

4.6.4.5. 启用 Insights Operator 收集操作

如果禁用了收集操作,您可以启用 Insights Operator 收集操作。

重要

InsightsDataGather 自定义资源只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。

有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围

先决条件

  • 以具有 cluster-admin 角色的用户身份登录到 OpenShift Container Platform Web 控制台。

流程

  1. 进入到 Administration CustomResourceDefinitions
  2. CustomResourceDefinitions 页面上,使用 Search by name 字段来查找 InsightsDataGather 资源定义并点它。
  3. CustomResourceDefinition 详情页面,点 Instances 选项卡。
  4. cluster,然后点 YAML 选项卡。
  5. 通过执行以下编辑之一来启用收集操作:

    • 要启用所有禁用的收集操作,请删除 gatherConfig 小节:

      apiVersion: config.openshift.io/v1alpha1
      kind: InsightsDataGather
      metadata:
      ....
      
      spec:
        gatherConfig: 1
          disabledGatherers: all
      1
      删除 gatherConfig 小节以启用所有收集操作。
    • 要启用单个收集操作,请删除 disabledGatherers 键下的值:

      spec:
        gatherConfig:
          disabledGatherers:
            - clusterconfig/container_images 1
            - clusterconfig/host_subnets
            - workloads/workload_info
      1
      删除一个或多个收集操作。
  6. 点击 Save

    保存更改后,Insights Operator 收集配置将更新,受影响的收集操作启动。

注意

禁用收集操作降级 Insights Advisor 的功能,可为您的集群提供有效的建议。

4.6.5. 模糊处理 Deployment Validation Operator 数据

如果已安装 Operator,集群管理员可以将 Insight Operator 配置为模糊来自 Deployment Validation Operator (DVO) 的数据。当 workload_names 值添加到 insights-config ConfigMap 对象中时,工作负载名称比 Openshift 的 Insights 中显示的 workload name-rather 会显示,从而使它们更适合集群管理员。

先决条件

  • 启用了远程健康报告(这是默认设置)。
  • 使用 "cluster-admin" 角色登录到 OpenShift Container Platform Web 控制台。
  • insights-config ConfigMap 对象存在于 openshift-insights 命名空间中。
  • 集群被自我管理,并安装了 Deployment Validation Operator。

流程

  1. 进入 Workloads ConfigMaps 并选择 Project: openshift-insights
  2. insights-config ConfigMap 对象打开它。
  3. Actions 并选择 Edit ConfigMap
  4. YAML 视图 单选按钮。
  5. 在文件中,使用 workload_names 值设置 obfuscation 属性。

    apiVersion: v1
    kind: ConfigMap
    # ...
    data:
      config.yaml: |
        dataReporting:
          obfuscation:
            - workload_names
    # ...
  6. 点击 Saveinsights-config config-map 详情页面将打开。
  7. 验证 config.yaml obfuscation 属性的值是否已设置为 - workload_names
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.