kubernetes argocd-image-updater设置Application kustomize image,但部署image保持不变

q9yhzks0  于 2023-04-29  发布在  Kubernetes
关注(0)|答案(1)|浏览(269)

描述bug

argocd-image-updater正在运行,从我们的www. example中看到有效的候选图像 www.example.com 。部署映像具有客户化。yaml。这可能只是argocd-image-updater或argocd中的一个基本配置问题,但我找不到任何完整的argocd-image-update kustomization实现的示例。(我已经在他们的问题上发布了这个,并做了一些挖掘,但这个项目一直很安静)。即使只是一些工作的kustomize示例的例子也可以在这里完成这个任务;我主要不确定Application镜像应该如何更新kustomize镜像以及kubernetes部署镜像
更新程序日志:

time="2023-03-31T17:52:45Z" level=info msg="Starting image update cycle, considering 1 annotated application(s) for update"
time="2023-03-31T17:52:45Z" level=debug msg="Processing application doc-storage-ui"
time="2023-03-31T17:52:45Z" level=debug msg="Considering this image for update" alias=doc-storage-ui application=doc-storage-ui image_name=cblairupliv/doc-storage-ui image_tag= registry=
time="2023-03-31T17:52:45Z" level=debug msg="Using no version constraint when looking for a new tag" alias=doc-storage-ui application=doc-storage-ui image_name=cblairupliv/doc-storage-ui image_tag= registry=
time="2023-03-31T17:52:45Z" level=debug msg="could not parse input tag latest as semver: Invalid Semantic Version"
time="2023-03-31T17:52:45Z" level=debug msg="could not parse input tag pr-latest as semver: Invalid Semantic Version"
time="2023-03-31T17:52:45Z" level=debug msg="could not parse input tag staging as semver: Invalid Semantic Version"
time="2023-03-31T17:52:45Z" level=debug msg="found 5 from 5 tags eligible for consideration" image=cblairupliv/doc-storage-ui
time="2023-03-31T17:52:45Z" level=info msg="Setting new image to cblairupliv/doc-storage-ui:0.1.45" alias=doc-storage-ui application=doc-storage-ui image_name=cblairupliv/doc-storage-ui image_tag= registry=
time="2023-03-31T17:52:45Z" level=info msg="Successfully updated image 'cblairupliv/doc-storage-ui' to 'cblairupliv/doc-storage-ui:0.1.45', but pending spec update (dry run=false)" alias=doc-storage-ui application=doc-storage-ui image_name=cblairupliv/doc-storage-ui image_tag= registry=
time="2023-03-31T17:52:45Z" level=debug msg="Using commit message: "
time="2023-03-31T17:52:45Z" level=info msg="Committing 1 parameter update(s) for application doc-storage-ui" application=doc-storage-ui
time="2023-03-31T17:52:45Z" level=info msg="Successfully updated the live application spec" application=doc-storage-ui
time="2023-03-31T17:52:45Z" level=info msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=1 errors=0"

应用程序已更新(请注意,图像是cblairupliv/doc-storage-ui:0的正确最新版本。1.45;抱歉,如此冗长,但可能会带来一些启示):

kc describe app -nargocd doc-storage-ui
Name:         doc-storage-ui
Namespace:    argocd
Labels:       <none>
Annotations:  argocd-image-updater.argoproj.io/argocd.kustomize.image-name: index.docker.io/cblairupliv/doc-storage-ui
              argocd-image-updater.argoproj.io/doc-storage-ui.update-strategy: semver
              argocd-image-updater.argoproj.io/image-list: doc-storage-ui=index.docker.io/cblairupliv/doc-storage-ui
              argocd-image-updater.argoproj.io/write-back-target: kustomization
API Version:  argoproj.io/v1alpha1
Kind:         Application
Metadata:
  Creation Timestamp:  2023-03-31T17:34:54Z
  Generation:          1422
  Managed Fields:
    API Version:  argoproj.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:argocd-image-updater.argoproj.io/argocd.kustomize.image-name:
          f:argocd-image-updater.argoproj.io/doc-storage-ui.update-strategy:
          f:argocd-image-updater.argoproj.io/image-list:
          f:argocd-image-updater.argoproj.io/write-back-target:
      f:spec:
        .:
        f:destination:
          .:
          f:namespace:
          f:server:
        f:project:
        f:source:
          .:
          f:path:
          f:repoURL:
          f:targetRevision:
        f:syncPolicy:
          .:
          f:automated:
            .:
            f:prune:
            f:selfHeal:
          f:syncOptions:
      f:status:
        .:
        f:health:
        f:summary:
        f:sync:
          .:
          f:comparedTo:
            .:
            f:destination:
            f:source:
    Manager:      argocd-server
    Operation:    Update
    Time:         2023-03-31T17:34:54Z
    API Version:  argoproj.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        f:source:
          f:kustomize:
            .:
            f:images:
    Manager:      argocd-image-updater
    Operation:    Update
    Time:         2023-03-31T17:36:42Z
    API Version:  argoproj.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        f:health:
          f:status:
        f:history:
        f:operationState:
          .:
          f:finishedAt:
          f:message:
          f:operation:
            .:
            f:initiatedBy:
              .:
              f:automated:
            f:retry:
              .:
              f:limit:
            f:sync:
              .:
              f:prune:
              f:revision:
              f:syncOptions:
          f:phase:
          f:startedAt:
          f:syncResult:
            .:
            f:resources:
            f:revision:
            f:source:
              .:
              f:path:
              f:repoURL:
              f:targetRevision:
        f:reconciledAt:
        f:resources:
        f:sourceType:
        f:summary:
          f:images:
        f:sync:
          f:comparedTo:
            f:destination:
              f:namespace:
              f:server:
            f:source:
              f:kustomize:
                .:
                f:images:
              f:path:
              f:repoURL:
              f:targetRevision:
          f:revision:
          f:status:
    Manager:         argocd-application-controller
    Operation:       Update
    Time:            2023-03-31T17:36:43Z
  Resource Version:  6907890
  UID:               830639e6-0df5-4135-9713-5ba57453a892
Spec:
  Destination:
    Namespace:  default
    Server:     https://kubernetes.default.svc
  Project:      default
  Source:
    Kustomize:
      Images:
        cblairupliv/doc-storage-ui:0.1.45
    Path:             argocd/prod/doc-storage-ui/k8s
    Repo URL:         https://github.com/upliv-health/iac
    Target Revision:  main
  Sync Policy:
    Automated:
      Prune:      true
      Self Heal:  true
    Sync Options:
      CreateNamespace=true
Status:
  Health:
    Status:  Healthy
  History:
    Deploy Started At:  2023-03-31T17:34:54Z
    Deployed At:        2023-03-31T17:34:54Z
    Id:                 0
    Revision:           e580c3e3b944f17c590a498bd27b7e35be088f86
    Source:
      Path:             argocd/prod/doc-storage-ui/k8s
      Repo URL:         https://github.com/upliv-health/iac
      Target Revision:  main
  Operation State:
    Finished At:  2023-03-31T17:34:54Z
    Message:      successfully synced (all tasks run)
    Operation:
      Initiated By:
        Automated:  true
      Retry:
        Limit:  5
      Sync:
        Prune:     true
        Revision:  e580c3e3b944f17c590a498bd27b7e35be088f86
        Sync Options:
          CreateNamespace=true
    Phase:       Succeeded
    Started At:  2023-03-31T17:34:54Z
    Sync Result:
      Resources:
        Group:
        Hook Phase:  Running
        Kind:        Service
        Message:     service/doc-storage-ui created
        Name:        doc-storage-ui
        Namespace:   default
        Status:      Synced
        Sync Phase:  Sync
        Version:     v1
        Group:
        Hook Phase:  Running
        Kind:        Service
        Message:     service/doc-storage-ui-service-cluster-ip created
        Name:        doc-storage-ui-service-cluster-ip
        Namespace:   default
        Status:      Synced
        Sync Phase:  Sync
        Version:     v1
        Group:
        Hook Phase:  Running
        Kind:        Service
        Message:     service/doc-storage-ui-service-loadbalancer created
        Name:        doc-storage-ui-service-loadbalancer
        Namespace:   default
        Status:      Synced
        Sync Phase:  Sync
        Version:     v1
        Group:       apps
        Hook Phase:  Running
        Kind:        Deployment
        Message:     deployment.apps/doc-storage-ui created
        Name:        doc-storage-ui
        Namespace:   default
        Status:      Synced
        Sync Phase:  Sync
        Version:     v1
      Revision:      e580c3e3b944f17c590a498bd27b7e35be088f86
      Source:
        Path:             argocd/prod/doc-storage-ui/k8s
        Repo URL:         https://github.com/upliv-health/iac
        Target Revision:  main
  Reconciled At:          2023-04-03T16:02:40Z
  Resources:
    Health:
      Status:   Healthy
    Kind:       Service
    Name:       doc-storage-ui
    Namespace:  default
    Status:     Synced
    Version:    v1
    Health:
      Status:   Healthy
    Kind:       Service
    Name:       doc-storage-ui-service-cluster-ip
    Namespace:  default
    Status:     Synced
    Version:    v1
    Health:
      Status:   Healthy
    Kind:       Service
    Name:       doc-storage-ui-service-loadbalancer
    Namespace:  default
    Status:     Synced
    Version:    v1
    Group:      apps
    Health:
      Status:   Healthy
    Kind:       Deployment
    Name:       doc-storage-ui
    Namespace:  default
    Status:     Synced
    Version:    v1
  Source Type:  Kustomize
  Summary:
    Images:
      index.docker.io/cblairupliv/doc-storage-ui
  Sync:
    Compared To:
      Destination:
        Namespace:  default
        Server:     https://kubernetes.default.svc
      Source:
        Kustomize:
          Images:
            cblairupliv/doc-storage-ui:0.1.45
        Path:             argocd/prod/doc-storage-ui/k8s
        Repo URL:         https://github.com/upliv-health/iac
        Target Revision:  main
    Revision:             e580c3e3b944f17c590a498bd27b7e35be088f86
    Status:               Synced
Events:
  Type    Reason         Age    From                Message
  ----    ------         ----   ----                -------
  Normal  ImagesUpdated  59m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  57m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  55m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  53m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  51m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  48m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  46m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  44m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  42m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  40m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  38m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  36m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  34m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  32m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  30m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  28m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  26m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  24m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  22m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  20m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  18m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  16m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  14m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  12m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  10m    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  8m53s  ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  6m52s  ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  4m52s  ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  2m52s  ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'
  Normal  ImagesUpdated  51s    ArgocdImageUpdater  Successfully updated application 'doc-storage-ui'

k8s中未更新部署:

kc describe deployment doc-storage-ui
Name:                   doc-storage-ui
Namespace:              default
CreationTimestamp:      Fri, 31 Mar 2023 10:34:54 -0700
Labels:                 app=doc-storage-ui
                        app.kubernetes.io/instance=doc-storage-ui
                        tier=web
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=doc-storage-ui,tier=web
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=doc-storage-ui
           tier=web
  Containers:
   doc-storage-ui:
    Image:      index.docker.io/cblairupliv/doc-storage-ui
    Port:       3000/TCP
    Host Port:  0/TCP
    Command:
      node
      server.js
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   doc-storage-ui-68c575f855 (1/1 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  35m   deployment-controller  Scaled up replica set doc-storage-ui-68c575f855 to 1

展开yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: doc-storage-ui
  labels:
    app: doc-storage-ui
    tier: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: doc-storage-ui
      tier: web
  template:
    metadata:
      labels:
        app: doc-storage-ui
        tier: web
    spec:
      # Credential for private docker.com repository.
      imagePullSecrets:
        - name: regcred
      containers:
      - name: doc-storage-ui
        image: index.docker.io/cblairupliv/doc-storage-ui
        imagePullPolicy: Always
        ports:
          - containerPort: 3000
        command: ["node", "server.js"]

还有美食。yaml与部署在同一目录中。亚姆勒:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cluster-ip.yaml
- deployment.yaml
- loadbalancer.yaml
- service.yaml
images:
- name: doc-storage-ui
  newName: index.docker.io/cblairupliv/doc-storage-ui
  newTag: latest

再现再现行为步骤:

  • 在yaml中配置类似于上面的argocd ^
  • 查看argocd-image-update pod k8s日志,并验证找到并更新的图像
  • 验证应用程序映像是否如上所述更新
  • 验证部署映像是否未更新
    预期行为部署中要更新的映像版本
    附加上下文截至今天argoc和argocd-image-updater的最新安装。
    版本见上
    日志上面有很多日志。
yfwxisqw

yfwxisqw1#

似乎删除注册表前缀(@TheDome提到)解决了我的问题。不知道为什么

相关问题