【问题标题】:Argo CD - limit time for Application for transit to Degradated stateArgo CD - 申请过渡到退化状态的限制时间
【发布时间】:2022-07-26 15:31:59
【问题描述】:

这是我们坚持的常见场景:

  1. Argocd 应用程序创建并与 Helm 同步,部署了 1 个 pod,全部为绿色。
  2. 我们使用 Docker 镜像注册表中不存在的一些损坏值更新部署镜像标签,并将更改推送到 git 存储库。
  3. Argo 从 git repo 获取更新,同步状态为绿色同步状态,但应用程序运行状况为“处理中”
  4. 由于更改,Deployment 尝试推出带有损坏图像标签的新 pod,但显然无法做到。
  5. Agrocd 应用程序卡在应用程序健康“处理”状态大约 10 分钟,并最终过渡到“降级”状态

现在的问题是,我们能否限制这个时间并在 1 或 2 分钟而不是 10 分钟内达到“降级”状态?

【问题讨论】:

  • 看起来第二张截图可能是错误的图像?

标签: argocd


【解决方案1】:

您是否使用 GUI 或 yaml 文件创建应用程序?
如果您使用 yaml 文件创建应用程序,您可以通过在重试中设置字段限制或 maxDuration 来实现。
这是一个例子

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  # You'll usually want to add your resources to the argocd namespace.
  namespace: argocd
  # Add a this finalizer ONLY if you want these to cascade delete.
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  # The project the application belongs to.
  project: default

  # Source of the application manifests
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook

    # helm specific config
    helm:
      # Release name override (defaults to application name)
      releaseName: guestbook

      # Helm values files for overriding values in the helm chart
      # The path is relative to the spec.source.path directory defined above
      valueFiles:
      - values-prod.yaml

      # Optional Helm version to template with. If omitted it will fall back to look at the 'apiVersion' in Chart.yaml
      # and decide which Helm binary to use automatically. This field can be either 'v2' or 'v3'.
      version: v2

  # Destination cluster and namespace to deploy the application
  destination:
    server: https://kubernetes.default.svc
    namespace: guestbook

  # Sync policy
  syncPolicy:
    automated: # automated sync by default retries failed attempts 5 times with following delays between attempts ( 5s, 10s, 20s, 40s, 80s ); retry controlled using `retry` field.
      prune: true # Specifies if resources should be pruned during auto-syncing ( false by default ).
      selfHeal: true # Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected ( false by default ).
      allowEmpty: false # Allows deleting all application resources during automatic syncing ( false by default ).
    syncOptions:     # Sync options which modifies sync behavior
    - Validate=false # disables resource validation (equivalent to 'kubectl apply --validate=false') ( true by default ).
    - CreateNamespace=true # Namespace Auto-Creation ensures that namespace specified as the application destination exists in the destination cluster.
    - PrunePropagationPolicy=foreground # Supported policies are background, foreground and orphan.
    - PruneLast=true # Allow the ability for resource pruning to happen as a final, implicit wave of a sync operation
    # The retry feature is available since v1.7
    retry:
      limit: 5 # number of failed sync attempt retries; unlimited number of attempts if less than 0
      backoff:
        duration: 5s # the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")
        factor: 2 # a factor to multiply the base duration after each failed retry
        maxDuration: 3m # the maximum amount of time allowed for the backoff strategy

【讨论】:

  • 问题是应用后同步状态正常,但我会试试谢谢
【解决方案2】:

有什么解决办法吗?谢谢

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2023-02-09
  • 2021-01-20
  • 1970-01-01
  • 1970-01-01
  • 2023-01-13
  • 2013-07-17
  • 1970-01-01
相关资源
最近更新 更多