第 3 章 为支持收集诊断信息
当创建一个支持问题单时,您必须为红帽支持团队提供有关集群的调试信息。您可以使用 must-gather 工具来收集项目级别资源、集群级别资源和 Red Hat OpenShift GitOps 组件的诊断信息。
为了获得快速支持,请提供 OpenShift Container Platform 和 Red Hat OpenShift GitOps 的诊断信息。
3.1. 关于 must-gather 工具 复制链接链接已复制到粘贴板!
oc adm must-gather CLI 命令可收集最有助于解决问题的集群信息,包括:
- 资源定义
- 服务日志
默认情况下,oc adm must-gather 命令使用默认的插件镜像,并写入 ./must-gather.local。
另外,您可以使用适当的参数运行命令来收集具体信息,如以下部分所述:
要收集与一个或多个特定功能相关的数据,请使用
--image参数和镜像,如以下部分所述。示例命令
oc adm must-gather --image=registry.redhat.io/openshift-gitops-1/must-gather-rhel8:v1.10.0
$ oc adm must-gather --image=registry.redhat.io/openshift-gitops-1/must-gather-rhel8:v1.10.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要收集审计日志,请使用
-- /usr/bin/gather_audit_logs参数,如以下部分所述。示例命令
oc adm must-gather -- /usr/bin/gather_audit_logs
$ oc adm must-gather -- /usr/bin/gather_audit_logsCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意作为默认信息集合的一部分,不会收集审计日志来减小文件的大小。
当您运行 oc adm must-gather 时,集群的新项目中会创建一个带有随机名称的新 pod。在该 pod 上收集数据,并保存至以 must-gather.local 开头的一个新目录中。此目录在当前工作目录中创建。
Pod 示例
NAMESPACE NAME READY STATUS RESTARTS AGE ... openshift-must-gather-5drcj must-gather-bklx4 2/2 Running 0 72s openshift-must-gather-5drcj must-gather-s8sdh 2/2 Running 0 72s ...
NAMESPACE NAME READY STATUS RESTARTS AGE
...
openshift-must-gather-5drcj must-gather-bklx4 2/2 Running 0 72s
openshift-must-gather-5drcj must-gather-s8sdh 2/2 Running 0 72s
...
另外,您可以使用 --run-namespace 选项在特定命名空间中运行 oc adm must-gather 命令。
示例命令
oc adm must-gather --image=registry.redhat.io/openshift-gitops-1/must-gather-rhel8:v1.10.0
$ oc adm must-gather --image=registry.redhat.io/openshift-gitops-1/must-gather-rhel8:v1.10.0