×

您可以手动收集和上传Insights Operator归档文件,以诊断受限网络中的问题。

要在受限网络中使用Insights Operator,您必须

  • 创建Insights Operator归档文件的副本。

  • 将Insights Operator归档文件上传到console.redhat.com

此外,您还可以选择模糊处理上传前Insights Operator数据。

运行Insights Operator收集操作

您必须运行收集操作才能创建Insights Operator归档文件。

先决条件
  • 您已以cluster-admin身份登录到OpenShift Container Platform。

步骤
  1. 使用此模板创建一个名为gather-job.yaml的文件

    apiVersion: batch/v1
    kind: Job
    metadata:
      name: insights-operator-job
      annotations:
        config.openshift.io/inject-proxy: insights-operator
    spec:
      backoffLimit: 6
      ttlSecondsAfterFinished: 600
      template:
        spec:
          restartPolicy: OnFailure
          serviceAccountName: operator
          nodeSelector:
            beta.kubernetes.io/os: linux
            node-role.kubernetes.io/master: ""
          tolerations:
          - effect: NoSchedule
            key: node-role.kubernetes.io/master
            operator: Exists
          - effect: NoExecute
            key: node.kubernetes.io/unreachable
            operator: Exists
            tolerationSeconds: 900
          - effect: NoExecute
            key: node.kubernetes.io/not-ready
            operator: Exists
            tolerationSeconds: 900
          volumes:
          - name: snapshots
            emptyDir: {}
          - name: service-ca-bundle
            configMap:
              name: service-ca-bundle
              optional: true
          initContainers:
          - name: insights-operator
            image: quay.io/openshift/origin-insights-operator:latest
            terminationMessagePolicy: FallbackToLogsOnError
            volumeMounts:
            - name: snapshots
              mountPath: /var/lib/insights-operator
            - name: service-ca-bundle
              mountPath: /var/run/configmaps/service-ca-bundle
              readOnly: true
            ports:
            - containerPort: 8443
              name: https
            resources:
              requests:
                cpu: 10m
                memory: 70Mi
            args:
            - gather
            - -v=4
            - --config=/etc/insights-operator/server.yaml
          containers:
            - name: sleepy
              image: quay.io/openshift/origin-base:latest
              args:
                - /bin/sh
                - -c
                - sleep 10m
              volumeMounts: [{name: snapshots, mountPath: /var/lib/insights-operator}]
  2. 复制您的insights-operator镜像版本

    $ oc get -n openshift-insights deployment insights-operator -o yaml
    示例输出
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: insights-operator
      namespace: openshift-insights
    # ...
    spec:
      template:
    # ...
        spec:
          containers:
          - args:
    # ...
            image: registry.ci.openshift.org/ocp/4.15-2023-10-12-212500@sha256:a0aa581400805ad0... (1)
    # ...
    1 指定您的insights-operator镜像版本。
  3. 将您的镜像版本粘贴到gather-job.yaml

    apiVersion: batch/v1
    kind: Job
    metadata:
      name: insights-operator-job
    # ...
    spec:
    # ...
      template:
        spec:
        initContainers:
        - name: insights-operator
          image: image: registry.ci.openshift.org/ocp/4.15-2023-10-12-212500@sha256:a0aa581400805ad0... (1)
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
    1 将任何现有值替换为您的insights-operator镜像版本。
  4. 创建收集作业

    $ oc apply -n openshift-insights -f gather-job.yaml
  5. 找到作业Pod的名称

    $ oc describe -n openshift-insights job/insights-operator-job
    示例输出
    Name:             insights-operator-job
    Namespace:        openshift-insights
    # ...
    Events:
      Type    Reason            Age    From            Message
      ----    ------            ----   ----            -------
      Normal  SuccessfulCreate  7m18s  job-controller  Created pod: insights-operator-job-<your_job>
    其中

    insights-operator-job-<your_job>是Pod的名称。

  6. 验证操作是否已完成

    $ oc logs -n openshift-insights insights-operator-job-<your_job> insights-operator
    示例输出
    I0407 11:55:38.192084       1 diskrecorder.go:34] Wrote 108 records to disk in 33ms
  7. 保存创建的归档文件

    $ oc cp openshift-insights/insights-operator-job-<your_job>:/var/lib/insights-operator ./insights-data
  8. 清理作业

    $ oc delete -n openshift-insights job insights-operator-job

上传Insights Operator归档文件

您可以手动将Insights Operator归档文件上传到console.redhat.com以诊断潜在问题。

先决条件
  • 您已以cluster-admin身份登录到OpenShift Container Platform。

  • 您有一台具有不受限制的互联网访问权限的工作站。

  • 您已创建Insights Operator归档文件的副本。

步骤
  1. 下载dockerconfig.json文件

    $ oc extract secret/pull-secret -n openshift-config --to=.
  2. dockerconfig.json文件中复制您的"cloud.openshift.com" "auth"令牌

    {
      "auths": {
        "cloud.openshift.com": {
          "auth": "<your_token>",
          "email": "[email protected]"
        }
    }
  3. 将归档文件上传到console.redhat.com

    $ curl -v -H "User-Agent: insights-operator/one10time200gather184a34f6a168926d93c330 cluster/<cluster_id>" -H "Authorization: Bearer <your_token>" -F "upload=@<path_to_archive>; type=application/vnd.redhat.openshift.periodic+tar" https://console.redhat.com/api/ingress/v1/upload

    其中<cluster_id>是您的集群ID,<your_token>是您拉取密钥中的令牌,<path_to_archive>是Insights Operator归档文件的路径。

    如果操作成功,命令将返回"request_id""account_number"

    示例输出
    * Connection #0 to host console.redhat.com left intact
    {"request_id":"393a7cf1093e434ea8dd4ab3eb28884c","upload":{"account_number":"6274079"}}%
验证步骤
  1. 登录到https://console.redhat.com/openshift

  2. 单击左侧窗格中的集群列表菜单。

  3. 要显示集群的详细信息,请单击集群名称。

  4. 打开集群的Insights Advisor选项卡。

    如果上传成功,选项卡将显示以下内容之一:

    • 您的集群通过了所有建议,如果Insights Advisor未识别任何问题。

    • Insights Advisor检测到的问题列表,按风险(低、中、高和严重)优先级排序。

启用Insights Operator数据模糊处理

您可以启用模糊处理来屏蔽Insights Operator发送到console.redhat.com的敏感和可识别IPv4地址以及集群基础域名。

尽管此功能可用,但Red Hat建议保持模糊处理禁用状态,以获得更有效的支持体验。

模糊处理会为集群IPv4地址分配非识别值,并使用保留在内存中的转换表将IP地址更改为其模糊处理版本,然后再将数据上传到console.redhat.com

对于集群基础域名,混淆处理会将基础域名更改为硬编码的子字符串。例如,cluster-api.openshift.example.com 将变为 cluster-api.<CLUSTER_BASE_DOMAIN>

以下步骤演示如何使用openshift-config命名空间中的support密钥启用混淆处理。

先决条件
  • 您已以cluster-admin身份登录到OpenShift Container Platform Web 控制台。

步骤
  1. 导航到工作负载密钥

  2. 选择openshift-config项目。

  3. 使用按名称搜索字段搜索support密钥。如果密钥不存在,请单击创建键值密钥进行创建。

  4. 单击选项菜单 kebab,然后单击编辑密钥

  5. 单击添加键/值

  6. 创建一个名为enableGlobalObfuscation的密钥,其值为true,然后单击保存

  7. 导航到工作负载Pod

  8. 选择openshift-insights项目。

  9. 找到insights-operator Pod。

  10. 要重新启动insights-operator Pod,请单击选项菜单 kebab,然后单击删除Pod

验证
  1. 导航到工作负载密钥

  2. 选择openshift-insights项目。

  3. 使用按名称搜索字段搜索obfuscation-translation-table密钥。

如果obfuscation-translation-table密钥存在,则表示混淆处理已启用并正常工作。

或者,您可以在Insights Operator归档文件中检查/insights-operator/gathers.json中是否存在值为"is_global_obfuscation_enabled": true

其他资源