Skip to content

CloudWave-4/cw-infra

Repository files navigation

cw-infra

ecr에 있는 이미지들을 eks에서 실행하기 위한 yaml 파일 저장소

클러스터에 직접 kubectl apply 금지

  • root-app 최초 1회만 수동 적용
  • 그 이후 모든 배포는 Git으로만 진행

2️⃣ 디렉터리 구조

cw-infra/
 ├── terraform/   → 인프라 (VPC, EKS, IAM)
 └── gitops/      → 쿠버네티스 리소스
      ├── root-app.yaml
      └── apps/
            ├── argocd/
            ├── keda/
            ├── monitoring/
            └── my-app/

3️⃣ 역할 분리

영역 담당 배포 방식
VPC / EKS Terraform 담당 terraform apply
ArgoCD 이후 모든 K8s 리소스 각 파트 담당 Git push

4️⃣ 새 애플리케이션 배포 방법

STEP 1️⃣

apps 밑에 디렉터리 생성

gitops/apps/my-service/

STEP 2️⃣

그 안에 배포 정의 작성

예:

  • deployment.yaml
  • service.yaml
  • ingress.yaml (또는 ALB Ingress)
  • values.yaml (Helm일 경우)

STEP 3️⃣

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

STEP 4️⃣

Git push

git add .
git commit -m"feat: add my-service"
git push origin main

STEP 5️⃣

ArgoCD가 자동 동기화

확인:

kubectl get applications -n argocd

또는 UI 확인


5️⃣ 수정 방법

YAML 수정 → Git push

절대:

kubectl edit
kubectl apply -f

하지 말 것.

ArgoCD가 되돌림.


6️⃣ 삭제 방법

apps 디렉터리에서 해당 폴더 삭제 후 push

(prune=true이므로 클러스터에서도 자동 삭제됨)


7️⃣ 장애 대응 규칙

  • Sync 에러 발생 시 YAML 확인
  • 콘솔에서 수동 수정 금지
  • Git 수정 후 push

8️⃣ Terraform 관련 규칙

  • terraform 코드는 Git에 push
  • tfstate는 S3 backend 사용
  • tfstate 파일은 Git에 올리지 않음
  • terraform 변경은 담당자만 수행

About

ecr에 있는 이미지들을 eks에서 실행하기 위한 yaml 파일 저장소

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages