ArgoCD + kustomize 적용하기 (+ argocd-image-updater)

이언철·2022년 10월 21일
0

GitOps

목록 보기
1/2
post-thumbnail

Template 형식으로 간단하게 작성

1. argocd install

2. argocd-image-updater install

3. application 및 kustomize 등록

[repo - argocd-applications structure]

  • applications
    • projectName
      • dev (digest)
        • backend.yaml
          apiVersion: argoproj.io/v1alpha1
          kind: Application
          metadata:
          name: backend-dev
          namespace: default
          annotations:
            argocd-image-updater.argoproj.io/image-list: backend-dev=XXX.dkr.ecr.ap-northeast-2.amazonaws.com/backend:dev
            argocd-image-updater.argoproj.io/backend-dev.update-strategy: digest
            argocd-image-updater.argoproj.io/backend-dev.pull-secret: ext:/app/config/ecr.sh
          spec:
          project: devops
          destination:
            name: dev-cluster
            namespace: default
          source:
            path: application/projectName/backend/overlays/dev
            repoURL: git@github.com:TEAM/k8s-manifest.git
            targetRevision: dev
          syncPolicy:
            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
            - ApplyOutOfSyncOnly=true
            - RespectIgnoreDifferences=true
            - Replace=true
            # The retry feature is available since v1.7
            retry:
              limit: 1 # 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
        • frontend.yaml
      • staging (latest)
      • prod (latest or semver)

[repo - k8s-kustomize structure]

  • applications

    • projectName

      • backend

        • base

          • deployment.yaml

          • service.yaml

          • kustomization.yaml

            apiVersion: kustomize.config.k8s.io/v1beta1
            kind: Kustomization
            
            resources:
            - deployment.yaml
            - service.yaml
        • overlays

          • dev

            • kustomization.yaml

               apiVersion: kustomize.config.k8s.io/v1beta1
               kind: Kustomization
              
               resources:
               - ../../base
              
               namespace: dev
               images:
               - name: XXX.dkr.ecr.ap-northeast-2.amazonaws.com/backend
                 newTag: 0.0.2
          • staging

          • prod

profile
Soomgo, DevOps

0개의 댓글