๐น Argo Rollouts๋?
Argo Rollouts๋ Kubernetes์์ Blue-Green, Canary ๋ฐฐํฌ์ ๊ฐ์ ์ ์ง์ ๋ฐฐํฌ ์ ๋ต์ ์ง์ํ๋ ์ปจํธ๋กค๋ฌ์
๋๋ค.
Argo CD์ ํจ๊ป ์ฌ์ฉํ๋ฉด GitOps ๋ฐฉ์์ผ๋ก ๋ฐฐํฌ ์ ๋ต์ ์ ์ธ์ ์ผ๋ก ๊ด๋ฆฌํ ์ ์์ต๋๋ค.
โ Argo Rollouts๋ฅผ ํ์ฉํด์ผ ํ๋ ์ด์
โ ์๋น์ค ๋ฌด์ค๋จ ๋ฐฐํฌ ๊ฐ๋ฅ
โ Canary ๋ฐฐํฌ๋ฅผ ํตํด ์ ๊ท ๋ฒ์ ์ ์์ ์ฑ ๊ฒ์ฆ ๊ฐ๋ฅ
โ ํธ๋ํฝ์ ์ ์ง์ ์ผ๋ก ์ด๋์ํค๋ฉด์ ์ค๋ฅ ๋ฐ์ ์ ๋กค๋ฐฑ ๊ฐ๋ฅ
โ Argo CD์ ์ฐ๊ณํ์ฌ GitOps ๋ฐฉ์์ผ๋ก ๋ฐฐํฌ ์๋ํ ๊ฐ๋ฅ
โ Argo Rollouts๊ฐ ์ง์ํ๋ ๋ฐฐํฌ ์ ๋ต
๋ฐฐํฌ ์ ๋ต | ์ค๋ช |
Blue-Green ๋ฐฐํฌ | ๊ธฐ์กด ๋ฒ์ (Blue)๊ณผ ์๋ก์ด ๋ฒ์ (Green)์ ๋์์ ์คํํ๊ณ , ํธ๋ํฝ์ Green์ผ๋ก ์ ํ |
Canary ๋ฐฐํฌ | ์ ๊ท ๋ฒ์ ์ ํธ๋ํฝ์ ์ ์ง์ ์ผ๋ก ์ฆ๊ฐ์ํค๋ฉด์ ๋ชจ๋ํฐ๋ง ํ ์ ์ฒด ์ ํ |
Progressive Delivery | Canary ๋ฐฐํฌ๋ฅผ ๋ ์ธ๋ถํํ์ฌ A/B ํ ์คํธ ๋ฐ ์คํ์ ์ธ ๋ฐฐํฌ ๊ฐ๋ฅ |
๐น 1. Argo CD์์ Argo Rollouts ํ์ฑํ ๋ฐฉ๋ฒ
Argo Rollouts๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด Argo CD์์ Rollout ๋ฆฌ์์ค๋ฅผ ์ง์ํ๋๋ก ์ค์ ํด์ผ ํฉ๋๋ค.
โ Argo Rollouts ์ปจํธ๋กค๋ฌ ์ค์น (Helm Chart ์ฌ์ฉ)
helm install argo-rollouts argo/argo-rollouts -n argo-rollouts --create-namespace
โ
์ค๋ช
:
โ argo-rollouts → Argo Rollouts ์ปจํธ๋กค๋ฌ๋ฅผ Kubernetes์ ์ค์น
โ --create-namespace → argo-rollouts ๋ค์์คํ์ด์ค๊ฐ ์์ผ๋ฉด ์์ฑ
โ ์ค์น๋ Rollouts ์ปจํธ๋กค๋ฌ ํ์ธ
kubectl get pods -n argo-rollouts
โ ์ถ๋ ฅ ์์:
NAME READY STATUS RESTARTS AGE
argo-rollouts-7f69c98b74-xyz 1/1 Running 0 2m
๐น 2. Argo Rollouts๋ฅผ ํ์ฉํ Blue-Green ๋ฐฐํฌ ์์
โ Blue-Green ๋ฐฐํฌ ์ ๋ต์ ์ ์ฉํ Rollout ๋ฆฌ์์ค
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: example-blue-green
namespace: example
spec:
replicas: 3 # ์คํํ ํ๋ ์
strategy:
blueGreen:
activeService: example-service # ํ์ฌ ์๋น์ค(Blue)
previewService: example-preview # ์ ๊ท ๋ฒ์ ์๋น์ค(Green)
autoPromotionEnabled: false # ์๋ ์น๊ฒฉ ๋นํ์ฑํ (์๋ ์ ํ)
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
containers:
- name: example
image: ghcr.io/example/app:v2 # ์๋ก์ด ๋ฒ์
ports:
- containerPort: 80
โ
์ค๋ช
:
โ blueGreen.activeService: example-service → ํ์ฌ ๋ฒ์ (Blue) ์๋น์ค
โ blueGreen.previewService: example-preview → ์๋ก์ด ๋ฒ์ (Green) ์๋น์ค
โ autoPromotionEnabled: false → ์๋ ์น๊ฒฉ์ ๋นํ์ฑํํ์ฌ ์๋์ผ๋ก ์ ํ ๊ฐ๋ฅ
โ ์๋น์ค ๋ฆฌ์์ค ์ ์
apiVersion: v1
kind: Service
metadata:
name: example-service
namespace: example
spec:
selector:
app: example
ports:
- port: 80
โ ๋ฐฐํฌ ํ ์๋ก์ด ๋ฒ์ (Green) ํ์ธ
kubectl get rollout example-blue-green -n example
โ ์ถ๋ ฅ ์์:
NAME STRATEGY STATUS ACTIVE SERVICE PREVIEW SERVICE
example-blue-green BlueGreen Progressing example-service example-preview
โ ์๋ก์ด ๋ฒ์ ์ผ๋ก ์น๊ฒฉ(ํธ๋ํฝ ์ ํ)
kubectl argo rollouts promote example-blue-green -n example
โ ๋กค๋ฐฑ(๊ธฐ์กด ๋ฒ์ ์ผ๋ก ๋ณต๊ตฌ)
kubectl argo rollouts undo example-blue-green -n example
๐น 3. Argo Rollouts๋ฅผ ํ์ฉํ Canary ๋ฐฐํฌ ์์
โ Canary ๋ฐฐํฌ ์ ๋ต์ ์ ์ฉํ Rollout ๋ฆฌ์์ค
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: example-canary
namespace: example
spec:
replicas: 3 # ์คํํ ํ๋ ์
strategy:
canary:
steps:
- setWeight: 20 # 20% ํธ๋ํฝ์ ์ ๊ท ๋ฒ์ ์ผ๋ก ์ ํ
- pause: {duration: 60s} # 60์ด ๋๊ธฐ ํ ๋ค์ ๋จ๊ณ ์งํ
- setWeight: 50 # 50% ํธ๋ํฝ ์ ํ
- pause: {} # ์๋ ์น๊ฒฉ ๋๊ธฐ
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
containers:
- name: example
image: ghcr.io/example/app:v2 # ์ ๊ท ๋ฒ์
ports:
- containerPort: 80
โ
์ค๋ช
:
โ steps.setWeight: 20 → ์ด๊ธฐ ํธ๋ํฝ 20%๋ฅผ ์ ๊ท ๋ฒ์ ์ ํ ๋น
โ pause: {duration: 60s} → 60์ด ๋์ ์ํ ๋ชจ๋ํฐ๋ง ํ ๋ค์ ๋จ๊ณ ์งํ
โ setWeight: 50 → 50% ํธ๋ํฝ์ ์ ๊ท ๋ฒ์ ์ ํ ๋น
โ pause: {} → ์ฌ์ฉ์๊ฐ ์ง์ ์น๊ฒฉํ ๋๊น์ง ๋๊ธฐ
โ ํ์ฌ ๋ฐฐํฌ ์งํ ์ํ ํ์ธ
kubectl argo rollouts get rollout example-canary -n example
โ ์ถ๋ ฅ ์์:
NAME STRATEGY STATUS STEP
example-canary Canary Progressing 2/4
โ ์๋ ์น๊ฒฉ(100% ํธ๋ํฝ ์ ํ)
kubectl argo rollouts promote example-canary -n example
โ ๋กค๋ฐฑ(๊ธฐ์กด ๋ฒ์ ์ผ๋ก ๋ณต๊ตฌ)
kubectl argo rollouts undo example-canary -n example
๐น 4. Argo CD์ Argo Rollouts ์ฐ๋
Argo CD์์ Canary ๋ฐฐํฌ ๋๋ Blue-Green ๋ฐฐํฌ๋ฅผ ์๋์ผ๋ก ๊ด๋ฆฌํ๋ ค๋ฉด,
๋ค์๊ณผ ๊ฐ์ด Argo CD Application์ Rollout ๋ฆฌ์์ค๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
โ Argo CD Application์์ Argo Rollouts ๋ฐฐํฌ
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: example-rollout-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/repo.git
targetRevision: main
path: rollouts # Rollout ๋งค๋ํ์คํธ ๊ฒฝ๋ก
destination:
server: https://kubernetes.default.svc
namespace: example
syncPolicy:
automated:
prune: true
selfHeal: true
โ
์ค๋ช
:
โ source.path: rollouts → Rollout ๋ฆฌ์์ค๊ฐ ์ ์ฅ๋ Git ๊ฒฝ๋ก
โ syncPolicy.automated → ์๋ ๋๊ธฐํ ํ์ฑํ
โ Argo CD์์ ๋ฐฐํฌ ๋๊ธฐํ ์คํ
argocd app sync example-rollout-app
โ ๋ฐฐํฌ๋ Argo Rollouts ์ํ ํ์ธ
kubectl get rollouts -n example
๐น ๊ฒฐ๋ก : ์ด๋ฒ ๊ธ์์ ๋ฐฐ์ด ํต์ฌ ๋ด์ฉ ์ ๋ฆฌ
๐ข Argo Rollouts๋ฅผ ์ฌ์ฉํ๋ฉด Canary, Blue-Green ๋ฐฐํฌ ์ ๋ต์ GitOps ๋ฐฉ์์ผ๋ก ์๋ํ ๊ฐ๋ฅ
๐ข Argo CD์ Argo Rollouts๋ฅผ ์ฐ๋ํ๋ฉด Kubernetes ๋ฐฐํฌ๋ฅผ ์ ์ง์ ์ผ๋ก ์ ์ฉ ๊ฐ๋ฅ
๐ข ๋ฐฐํฌ ์คํจ ์ Rollback ๊ธฐ๋ฅ์ ํ์ฉํ์ฌ ์์ ์ ์ธ ์ด์ ๊ฐ๋ฅ
๐ข GitOps ๊ธฐ๋ฐ์ผ๋ก ๋ฐฐํฌ ์ ๋ต์ ์ ์ธ์ ์ผ๋ก ๊ด๋ฆฌํ์ฌ ์ด์ ๋ถ๋ด์ ์ค์ผ ์ ์์