Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

KJH

ArgoCD App of Apps, Rollout 본문

DevOps

ArgoCD App of Apps, Rollout

모이스쳐라이징 2025. 5. 2. 02:04

App of Apps 패턴은 ArgoCD에서 여러 애플리케이션을 계층적으로 관리할 수 있는 구조이다.

루트 폴더에 Application.yaml들의 집합체로 구성이 되어 있다.

 

gitops-repo에 apps 폴더가 있어야 한다.

# 루트 애플리케이션 예시
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: root-app
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/your-org/gitops-repo.git
    targetRevision: HEAD
    path: apps
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd
  syncPolicy:
    automated: {}

 

 

apps 폴더 아래에는 여러 Application yaml을 배치한다.

gitops-repo/
├── apps
│   ├── bookinfo.yaml
│   ├── istio-base.yaml
│   ├── istio-egressgateway.yaml
│   ├── istio-ingressgateway.yaml
│   ├── istio-resources.yaml
│   ├── istiod-1-24-3.yaml
│   └── todo-api.yaml

 

실무에선 apps를 cluster 단위로 분리할 수 있다.

gitops-repo/
├── clusters/
│   ├── dev/
│   │   └── apps/
│   │       ├── app1.yaml
│   │       └── app2.yaml
│   ├── staging/
│   │   └── apps/
│   │       ├── app1.yaml
│   │       └── app2.yaml
│   └── prod/
│       └── apps/
│           ├── app1.yaml
│           └── app2.yaml

 

argoCD에선 하나의 Application yaml로 여러 Applcation을 손쉽게 배포할 수 있다.

 

 

※ 참고 bookinfo.yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: bookinfo
  namespace: argocd
spec:
  project: dev
  source:
    repoURL: https://github.com/your-org/gitops-repo.git
    targetRevision: test
    path: charts/python-1.0.0
    helm:
      releaseName: bookinfo
      valueFiles:
        - dev-values.yaml
  destination:
    name: dev
    namespace: bookinfo
  syncPolicy:
    automated:
      prune: false
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

 

 

---

 

Rollout

Canary, Blue-Green 배포를 지원하고, 메트릭 기반으로 롤백 및 다양한 컨트롤을 할 수 있게 된다.

Deployment와 유사하지만 훨씬 많은 기능을 제공한다.

 

Rollout의 기능을 사용하려면 대상 cluster에 CRD를 설치해야한다.

helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
helm install argo-rollouts argo/argo-rollouts

 

 

간단하게는 세가지 정도의 옵션이 올 수 있다.

 

1번째는 롤링배포

2번째는 blue green

3번째는 canray

 strategy:
  canary:
    maxSurge: 1                 # 새 버전의 Pod를 기존 replica 수 +1까지 초과 생성 허용
    maxUnavailable: 0          # 기존 버전 Pod는 항상 유지 (0개 이상 다운 안 됨)

      
  blueGreen:
    activeService: {{ include "app.fullname" . }}         # 현재 서비스 중인 Stable 버전에 연결되는 서비스
    previewService: {{ include "app.fullname" . }}-preview # 새 버전을 띄우고 연결하는 프리뷰용 서비스

    autoPromotionEnabled: false      # 자동 승격 비활성화 → 수동 promote 필요
    autoPromotionSeconds: 30         # autoPromotionEnabled: true일 경우, N초 후 자동 승격


  canary:
    steps:                           # 배포 진행 단계 정의
      - setWeight: 10                # 새 버전 트래픽 10%로 시작
      - pause: { duration: 30s }     # 30초 대기
      - setWeight: 50                # 트래픽을 50%로 증가
      - pause: { duration: 1m }      # 1분 대기

    trafficRouting:
      nginx:
        stableIngress: {{ include "app.fullname" . }}  # nginx Ingress를 사용해 트래픽 분배
        annotationPrefix: nginx.ingress.kubernetes.io  # Ingress에 붙일 annotation prefix

 

'DevOps' 카테고리의 다른 글

GPU Exporter (/w windows)  (0) 2025.04.21
Jmeter websocket 테스트 (/w nginx)  (0) 2025.04.18
Github 특정 Tag를 Fork하기  (0) 2025.04.16
Terraform GitOps(/w Atlantis)  (0) 2025.04.13
Nginx Ingress Controller OCSP 설정  (0) 2025.04.13