4.8. 通过验证安装 CR 对 GitOps ZTP 进行故障排除


ArgoCD 管道使用 SiteConfigPolicyGeneratorPolicyGentemplate 自定义资源(CR) 生成集群配置 CR 和 Red Hat Advanced Cluster Management (RHACM) 策略。使用以下步骤对此过程中可能出现的问题进行故障排除。

先决条件

  • 已安装 OpenShift CLI(oc)。
  • 已以具有 cluster-admin 权限的用户身份登录到 hub 集群。

流程

  1. 您可以使用以下命令检查安装 CR 是否已创建:

    $ oc get AgentClusterInstall -n <cluster_name>

    如果没有返回对象,请使用以下步骤对从 SiteConfig 文件到安装 CR 的 ArgoCD 管道流进行故障排除。

  2. 验证 ManagedCluster CR 是否使用 hub 集群上的 SiteConfig CR 生成:

    $ oc get managedcluster
  3. 如果缺少 ManagedCluster,请检查 clusters 应用程序是否将 Git 存储库中的文件与 hub 集群同步:

    $ oc get applications.argoproj.io -n openshift-gitops clusters -o yaml
    1. 要识别受管集群的错误日志,请检查 status.operationState.syncResult.resources 字段。例如,如果为 SiteConfig CR 中的 extraManifestPath 分配了一个无效的值,则会生成类似如下的错误:

      syncResult:
        resources:
        - group: ran.openshift.io
          kind: SiteConfig
          message: The Kubernetes API could not find ran.openshift.io/SiteConfig for
            requested resource spoke-sno/spoke-sno. Make sure the "SiteConfig" CRD is
            installed on the destination cluster
    2. 要查看更详细的 SiteConfig 错误,请完成以下步骤:

      1. 在 Argo CD 仪表板中,点 Argo CD 试图同步的 SiteConfig 资源。
      2. 选中 DESIRED MANIFEST 选项卡,以查找 siteConfigError 字段。

        siteConfigError: >- Error: could not build the entire SiteConfig defined by /tmp/kust-plugin-config-1081291903: stat sno-extra-manifest: no such file or directory
    3. 检查 Status.Sync 字段。如果有日志错误,Status.Sync 字段可能会指示 Unknown 错误:

      Status:
        Sync:
          Compared To:
            Destination:
              Namespace:  clusters-sub
              Server:     https://kubernetes.default.svc
            Source:
              Path:             sites-config
              Repo URL:         https://git.com/ran-sites/siteconfigs/.git
              Target Revision:  master
          Status:               Unknown
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.