ArgoCD Image Updater误判应用为Directory类型跳过更新求助
配置ArgoCD Image Updater时遇到"Directory类型不支持"的错误警告
警告日志
time="2024-11-01T14:19:53Z" level=warning msg="skipping app 'lumo-backend-app' of type 'Directory' because it's not of supported source type" application=lumo-backend-app time="2024-11-01T14:19:53Z" level=info msg="Starting image update cycle, considering 0 annotated application(s) for update" time="2024-11-01T14:19:53Z" level=info msg="Processing results: applications=0 images_considered=0 images_skipped=0 images_updated=0 errors=0"
问题描述
系统提示跳过lumo-backend-app,原因是其类型为Directory,但该应用实际是基于Git仓库的Kubernetes应用。已尝试重新部署应用、调整仓库结构等操作,问题仍未解决。
相关配置清单
Application清单
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: lumo-backend-app namespace: argocd annotations: argocd-image-updater.argoproj.io/image-list: ghcr.io/testlumo/backend spec: project: default source: repoURL: 'https://github.com/testlumo/backend.git' targetRevision: HEAD path: manifests destination: server: 'https://kubernetes.default.svc' namespace: default syncPolicy: automated: prune: true selfHeal: true
Deployment清单
apiVersion: apps/v1 kind: Deployment metadata: name: lumo-backend labels: app: lumo-backend spec: replicas: 1 selector: matchLabels: app: lumo-backend template: metadata: labels: app: lumo-backend spec: containers: - name: backend image: ghcr.io/testlumo/backend ports: - containerPort: 3000 imagePullSecrets: - name: ghcr-secret
仓库结构
根目录下包含manifests文件夹,内部存放上述Deployment等Kubernetes资源配置文件。
排查方向及解决方案
1. 检查ArgoCD应用的实际源类型
ArgoCD可能因缓存或同步问题误判应用类型,执行以下命令查看应用的源类型详情:
argocd app get lumo-backend-app -o yaml | grep -A5 source
如果输出中source.type显示为Directory,说明ArgoCD确实将其识别为目录类型,需要重新同步应用并刷新缓存:
argocd app sync lumo-backend-app --prune argocd app refresh lumo-backend-app
2. 完善Image Updater注解配置
当前注解仅指定了镜像列表,需补充更新策略等必要配置,让Image Updater明确处理规则。示例补充:
metadata: annotations: argocd-image-updater.argoproj.io/image-list: backend=ghcr.io/testlumo/backend argocd-image-updater.argoproj.io/backend.update-strategy: latest argocd-image-updater.argoproj.io/backend.image-field: spec.template.spec.containers[0].image
3. 升级ArgoCD Image Updater至稳定版本
部分旧版本存在Git目录类型应用的支持bug,升级到最新稳定版:
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/stable/manifests/install.yaml
4. 确认应用同步状态与仓库权限
确保ArgoCD能正常访问目标Git仓库,且应用同步状态为Synced,执行命令验证:
argocd app get lumo-backend-app
内容的提问来源于stack exchange,提问作者Enzo Legrand
相关产品推荐
相关产品推荐

