ecr에 있는 이미지들을 eks에서 실행하기 위한 yaml 파일 저장소
- root-app 최초 1회만 수동 적용
- 그 이후 모든 배포는 Git으로만 진행
cw-infra/
├── terraform/ → 인프라 (VPC, EKS, IAM)
└── gitops/ → 쿠버네티스 리소스
├── root-app.yaml
└── apps/
├── argocd/
├── keda/
├── monitoring/
└── my-app/
| 영역 | 담당 | 배포 방식 |
|---|---|---|
| VPC / EKS | Terraform 담당 | terraform apply |
| ArgoCD 이후 모든 K8s 리소스 | 각 파트 담당 | Git push |
apps 밑에 디렉터리 생성
gitops/apps/my-service/
그 안에 배포 정의 작성
예:
- deployment.yaml
- service.yaml
- ingress.yaml (또는 ALB Ingress)
- values.yaml (Helm일 경우)
application.yaml 작성
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-service
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/CloudWave-4/cw-infra
targetRevision: main
path: gitops/apps/my-service
destination:
server: https://kubernetes.default.svc
namespace: my-service
syncPolicy:
automated:
prune: true
selfHeal: true
Git push
git add .
git commit -m"feat: add my-service"
git push origin mainArgoCD가 자동 동기화
확인:
kubectl get applications -n argocd또는 UI 확인
YAML 수정 → Git push
절대:
kubectl edit
kubectl apply -f하지 말 것.
ArgoCD가 되돌림.
apps 디렉터리에서 해당 폴더 삭제 후 push
(prune=true이므로 클러스터에서도 자동 삭제됨)
- Sync 에러 발생 시 YAML 확인
- 콘솔에서 수동 수정 금지
- Git 수정 후 push
- terraform 코드는 Git에 push
- tfstate는 S3 backend 사용
- tfstate 파일은 Git에 올리지 않음
- terraform 변경은 담당자만 수행