5.11. 为红帽支持提供诊断数据

在解决 OpenShift Container Platform 问题时,红帽可能会要求您将诊断数据上传到支持问题单中。文件可以通过红帽客户门户网站或使用 redhat-support-tool 命令直接从 OpenShift Container Platform 集群上传到支持问题单。

先决条件

  • 您可以使用具有 cluster-admin 角色的用户访问集群。
  • 您需要有到主机的 SSH 访问权限。
  • 已安装 OpenShift CLI(oc)。
  • 您有红帽标准订阅或高级订阅。
  • 您有红帽客户门户网站帐户。
  • 您已有一个红帽支持问题单 ID。

流程

  • 通过红帽客户门户网站将诊断数据上传到现有红帽支持问题单中。

    1. 使用 oc debug node/<node_name> 命令调整一个 OpenShift Container Platform 节点中包含的诊断文件,并将输出重定向到文件中。以下示例将 debug 容器中的 /host/var/tmp/my-diagnostic-data.tar.gz 复制到 /var/tmp/my-diagnostic-data.tar.gz:

      $ oc debug node/my-cluster-node -- bash -c 'cat /host/var/tmp/my-diagnostic-data.tar.gz' > /var/tmp/my-diagnostic-data.tar.gz 1
      1
      debug 容器将主机的根目录挂载到 /host。在指定用于连接的目标文件时,引用 debug 容器的根目录的绝对路径,包括 /host
      注意

      运行 Red Hat Enterprise Linux CoreOS(RHCOS)的 OpenShift Container Platform 4.12 集群节点不可变,它依赖于 Operator 来应用集群更改。不建议使用 scp 从集群节点传输文件。但是,如果 OpenShift Container Platform API 不可用,或 kubelet 在目标节点上无法正常工作, oc 操作将会受到影响。在这种情况下,可以使用 scp core@<node>.<cluster_name>.<base_domain>:<file_path> <local_path> 从一个节点复制诊断文件。

    2. 在红帽客户门户网站的 Customer Support 页面中进入现有的支持问题单。
    3. 选择 Attach files 并按提示上传该文件。
  • 将诊断数据直接从 OpenShift Container Platform 集群上传到现有红帽支持问题单中。

    1. 获取集群节点列表:

      $ oc get nodes
    2. 在目标节点上进入一个 debug 会话。此步骤被实例化为一个名为 <node_name>-debug 的 debug pod:

      $ oc debug node/my-cluster-node
    3. /host 设为 debug shell 中的根目录。debug pod 在 pod 中的 /host 中挂载主机的 root 文件系统。将根目录改为 /host,您可以运行主机可执行路径中包含的二进制文件:

      # chroot /host
      注意

      运行 Red Hat Enterprise Linux CoreOS(RHCOS)的 OpenShift Container Platform 4.12 集群节点不可变,它依赖于 Operator 来应用集群更改。不建议使用 SSH 访问集群节点。但是,如果 OpenShift Container Platform API 不可用,或 kubelet 在目标节点上无法正常工作, oc 操作将会受到影响。在这种情况下,可以使用 ssh core@<node>.<cluster_name>.<base_domain> 来访问节点。

    4. 启动 toolbox 容器,其中包含运行 redhat-support-tool 所需的二进制文件:

      # toolbox
      注意

      如果一个已存在的 toolbox pod 已在运行,则 toolbox 命令会输出 'toolbox-' already exists.Trying to start…​.使用 podman rm toolbox- 删除正在运行的 toolbox 容器,并生成新的 toolbox 容器以避免出现问题。

      1. 运行 redhat-support-tool 将 debug pod 的文件直接附加到现有的红帽支持问题单中。这个示例使用支持问题单 ID '01234567' 和示例文件路径 /host/var/tmp/my-diagnostic-data.tar.gz:

        # redhat-support-tool addattachment -c 01234567 /host/var/tmp/my-diagnostic-data.tar.gz 1
        1
        toolbox 容器将主机的根目录挂载到 /host。当指定要通过 redhat-support-tool 命令上传的文件时,使用 toolbox 容器的根目录(包括 /host/ )的绝对路径。