4.20. 为支持问题单收集调试数据
当创建一个支持问题单时,您必须为红帽支持团队提供有关集群的调试信息。您可以使用 must-gather 工具来收集项目级别资源、集群级别资源和 Red Hat OpenShift GitOps 组件的诊断信息。
为了获得快速支持,请提供 OpenShift Container Platform 和 Red Hat OpenShift GitOps 的诊断信息。
4.20.1. 关于 must-gather 工具
oc adm must-gather CLI 命令可收集最有助于解决问题的集群信息,包括:
- 资源定义
- 服务日志
默认情况下,oc adm must-gather 命令使用默认的插件镜像,并写入 ./must-gather.local。
另外,您可以使用适当的参数运行命令来收集具体信息,如以下部分所述:
要收集与一个或多个特定功能相关的数据,请使用
--image参数和镜像,如以下部分所述。例如:
$ oc adm must-gather \ --image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel9:v4.13.3
要收集审计日志,请使用
-- /usr/bin/gather_audit_logs参数,如以下部分所述。例如:
$ oc adm must-gather -- /usr/bin/gather_audit_logs
注意作为默认信息集合的一部分,不会收集审计日志来减小文件的大小。
当您运行 oc adm must-gather 时,集群的新项目中会创建一个带有随机名称的新 pod。在该 pod 上收集数据,并保存至以 must-gather.local 开头的一个新目录中。此目录在当前工作目录中创建。
例如:
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 --run-namespace <namespace> \ --image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel9:v4.13.3
4.20.2. 为 Red Hat OpenShift GitOps 收集调试数据
使用 oc adm must-gather CLI 命令收集有关与 Red Hat OpenShift GitOps 关联的集群的以下详情:
- Red Hat OpenShift GitOps Operator 的订阅和命名空间。
-
ArgoCD 对象可用的命名空间,以及这些命名空间中的对象,如
ArgoCD,Applications,ApplicationSets,AppProjects, 和configmaps。 - 由 Red Hat OpenShift GitOps Operator 管理的命名空间列表,以及来自这些命名空间中的资源。
- 所有与 GitOps 相关的自定义资源对象和定义。
- Operator 和 Argo CD 日志。
- 警告和错误级事件。
先决条件
- 以管理员身份登录到 OpenShift Container Platform 集群。
-
已安装 OpenShift Container Platform CLI (
oc)。 - 已安装 Red Hat OpenShift GitOps Operator。
流程
- 进入到要存储调试信息的目录。
使用 Red Hat OpenShift GitOps
must-gather镜像运行oc adm must-gather命令:$ oc adm must-gather --image=registry.redhat.io/openshift-gitops-1/gitops-must-gather-rhel8:v1.9.0
must-gather工具会创建一个以当前目录中./must-gather.local开头的新目录。例如,./must-gather.local.4157245944708210399。从刚才创建的目录中创建压缩文件。例如,在使用 Linux 操作系统的计算机上运行以下命令:
$ tar -cvaf must-gather.tar.gz must-gather.local.4157245944708210399
- 在红帽客户门户中为您的问题单附上压缩文件。