Argo CD
- Kubernetes에 배포되는 GitOps 도구
- 지정된 Git 저장소와 클러스터 상태를 비교 (Sync)
로컬 의존성 구성
- argocd cli 설치
kind
(Kubernetes in Docker
) 설치하여 로컬에서 테스트 환경 구성
brew install kind argocd
Argo CD 설치
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl -n argocd port-forward svc/argocd-server 8080:443
Git 저장소 구조 예시
k8s/
├── base
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── service.yaml
└── overlays
├── dev
│ ├── common/...
│ ├── service-a/...
│ └── service-b/...
└── live
base
: 공통 리소스 정의
overlays
: 환경별 패치 및 리소스 추가
Kustomize
로 ci 런타임에 이용해 env 별 매니페스트 렌더링
Application 구성 전략
- 서비스별 Application 생성
- 공통 리소스(common)는 별도 Application으로 관리
- App-of-Apps 패턴으로 환경 단위 배포 순서 제어(sync-wave 사용)
EKS 등록
aws eks update-kubeconfig \
--region <region_name> \
--name <cluster_name>
argocd login <argocd-server> --username admin --password <pw> --insecure
argocd cluster add <cluster-name>
EKS 인증 관리 방식
argocd cluster add
명령어로 클러스터에 ServiceAccount와 권한 생성
- SA 토큰, CA, API 서버 주소를 Secret으로 저장
- Application Controller가 해당 Secret의 kubeconfig로 API 서버에 접근