19.3. 从命令行访问日志和自定义资源信息


您可以使用 must-gather 工具从命令行访问自定义资源(CR)的日志和信息。您必须将 must-gather 数据文件附加到所有客户问题单。

您可以使用过滤选项收集特定命名空间、完成、失败或取消迁移的虚拟机(VM)的数据。

注意

如果您在过滤的 must-gather 命令中指定不存在的资源,则不会创建存档文件。

先决条件

  • 您必须以具有 cluster-admin 角色的用户身份登录到 OpenShift Virtualization 集群。
  • 已安装 Red Hat OpenShift CLI (oc)

流程

  1. 进入要存储 must-gather 数据的目录。
  2. 运行 oc adm must-gather 命令:

    $ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4
    Copy to Clipboard Toggle word wrap

    数据被保存为 /must-gather/must-gather.tar.gz。您可以将此文件上传到红帽客户门户网站中的支持问题单中。

  3. 可选:使用以下选项运行 oc adm must-gather 命令来收集过滤的数据:

    • 命名空间:

      $ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \
        -- NS=<namespace> /usr/bin/targeted
      Copy to Clipboard Toggle word wrap
    • 迁移计划:

      $ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \
        -- PLAN=<migration_plan> /usr/bin/targeted
      Copy to Clipboard Toggle word wrap
    • 虚拟机:

      $ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \
        -- VM=<vm_name> NS=<namespace> /usr/bin/targeted 
      1
      Copy to Clipboard Toggle word wrap
      1
      您必须指定虚拟机名称,而不是虚拟机 ID,因为它出现在 Plan CR 中。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat