4.8. 通过验证安装 CR 对 GitOps ZTP 进行故障排除
ArgoCD 管道使用 SiteConfig
和 PolicyGenerator
或 PolicyGentemplate
自定义资源(CR) 生成集群配置 CR 和 Red Hat Advanced Cluster Management (RHACM) 策略。使用以下步骤对此过程中可能出现的问题进行故障排除。
先决条件
-
已安装 OpenShift CLI(
oc
)。 -
已以具有
cluster-admin
权限的用户身份登录到 hub 集群。
流程
您可以使用以下命令检查安装 CR 是否已创建:
$ oc get AgentClusterInstall -n <cluster_name>
如果没有返回对象,请使用以下步骤对从
SiteConfig
文件到安装 CR 的 ArgoCD 管道流进行故障排除。验证
ManagedCluster
CR 是否使用 hub 集群上的SiteConfig
CR 生成:$ oc get managedcluster
如果缺少
ManagedCluster
,请检查clusters
应用程序是否将 Git 存储库中的文件与 hub 集群同步:$ oc get applications.argoproj.io -n openshift-gitops clusters -o yaml
要识别受管集群的错误日志,请检查
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
要查看更详细的
SiteConfig
错误,请完成以下步骤:- 在 Argo CD 仪表板中,点 Argo CD 试图同步的 SiteConfig 资源。
选中 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
检查
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