ArgoCD는 Kubernetes를 위한 선언적 GitOps 지속적 배포(CD) 도구다. Git 저장소를 배포의 단일 진실 공급원(SSOT)으로 삼아 클러스터 상태를 자동으로 동기화한다.
GitOps 원칙
1. Git이 유일한 진실 소스
2. 원하는 상태(Desired) = Git의 YAML/Helm 차트
3. ArgoCD가 실제 상태(Actual)를 원하는 상태로 자동 맞춤
4. 변경은 반드시 Git 커밋을 통해
애플리케이션 정의
yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
namespace: argocd
spec:
project: production
source:
repoURL: https://github.com/myorg/k8s-configs.git
targetRevision: main
path: apps/myapp/overlays/production
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true # Git에서 삭제된 리소스 제거
selfHeal: true # 드리프트 자동 수정
syncOptions:
- CreateNamespace=true
ApplicationSet (멀티 클러스터)
yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-apps
spec:
generators:
- clusters: {} # 등록된 모든 클러스터
template:
spec:
source:
path: apps/{{name}}
destination:
server: "{{server}}"
관련 개념