๐น Argo CD์ ์๋น์ค ๋ฉ์ฌ(Istio)๋ฅผ ํจ๊ป ํ์ฉํด์ผ ํ๋ ์ด์
Kubernetes ํ๊ฒฝ์์๋ ๋ง์ดํฌ๋ก์๋น์ค ๊ฐ์ ํธ๋ํฝ์ ํจ์จ์ ์ผ๋ก ์ ์ดํ๊ณ ๊ด๋ฆฌํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
ํนํ, Istio์ ๊ฐ์ ์๋น์ค ๋ฉ์ฌ(Service Mesh) ๋ฅผ ํ์ฉํ๋ฉด ํธ๋ํฝ์ ์ ์ดํ ์ ์์ผ๋ฉฐ, Argo CD์ ์ฐ๋ํ๋ฉด ๋ฐฐํฌ ์๋ํ์ ํธ๋ํฝ ์ ์ด๋ฅผ ํจ๊ป ์ด์ํ ์ ์์ต๋๋ค.
โ Argo CD + Istio ์กฐํฉ์ด ํ์ํ ์ด์
โ Canary ๋ฐฐํฌ ๋ฐ ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ ์ต์ ํ
โ ํธ๋ํฝ ๋ผ์ฐํ
์ ์กฐ์ ํ์ฌ ํน์ ๋ฒ์ ์๋ง ํ
์คํธ ํธ๋ํฝ ์ ์ฉ ๊ฐ๋ฅ
โ ์๋น์ค ๊ฐ TLS ์ํธํ ๋ฐ Zero-Trust ๋คํธ์ํฌ ๊ตฌํ ๊ฐ๋ฅ
โ ๋ฐฐํฌ ์ค ์ฅ์ ๋ฐ์ ์ ๋น ๋ฅธ ๋กค๋ฐฑ ๊ฐ๋ฅ
๐น 1. Istio์ Argo CD ์ฐ๋์ ์ํ ๊ธฐ๋ณธ ๊ตฌ์ฑ
Argo CD์ Istio๋ฅผ ํจ๊ป ํ์ฉํ๋ ค๋ฉด, ๋จผ์ Istio๋ฅผ ์ค์นํด์ผ ํฉ๋๋ค.
โ 1.1 Istio ์ค์น
istioctl install --set profile=demo -y
โ
์ค๋ช
:
โ profile=demo → ๊ธฐ๋ณธ Istio ๋ฐ๋ชจ ํ๋กํ์ผ ์ค์น
โ ์ค์น ํ Istio์ IngressGateway, Control Plane, Sidecar Injector ๊ฐ ์๋ ๋ฐฐํฌ๋จ
โ Istio ์ค์น ํ์ธ
kubectl get pods -n istio-system
โ ์ถ๋ ฅ ์์:
NAME READY STATUS RESTARTS AGE
istiod-5f7d78d5b7-jw9sd 1/1 Running 0 2m
istio-ingressgateway-cd47d9b8f-kfj2d 1/1 Running 0 2m
๐น 2. Istio VirtualService๋ฅผ ํ์ฉํ ํธ๋ํฝ ์ ์ด
Istio์ VirtualService ๋ฅผ ํ์ฉํ๋ฉด ํน์ ํธ๋ํฝ์ ์ํ๋ ์๋น์ค ๋ฒ์ ์ผ๋ก ๋ผ์ฐํ
ํ ์ ์์ต๋๋ค.
์ด๋ฅผ ํตํด Canary ๋ฐฐํฌ ๋ฐ ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ๋ฅผ ์ ์ฉํ ์ ์์ต๋๋ค.
โ 2.1 Canary ๋ฐฐํฌ ์ค์ (80% Stable, 20% Canary)
๐ Canary ๋ฐฐํฌ๋ฅผ ์ํ VirtualService ์ค์
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: example-app
namespace: example
spec:
hosts:
- example-app.example.svc.cluster.local # ๋ด๋ถ ์๋น์ค ๋๋ฉ์ธ
http:
- route:
- destination:
host: example-app
subset: stable # ๊ธฐ์กด ์๋น์ค ๋ฒ์
weight: 80 # 80% ํธ๋ํฝ ํ ๋น
- destination:
host: example-app
subset: canary # ์๋ก์ด ์๋น์ค ๋ฒ์
weight: 20 # 20% ํธ๋ํฝ ํ ๋น
โ
์ค๋ช
:
โ route.destination.host: example-app → ๋์ ์๋น์ค ์ง์
โ subset: stable → ๊ธฐ์กด ๋ฒ์ (stable)์ผ๋ก 80% ํธ๋ํฝ
โ subset: canary → ์ ๊ท ๋ฒ์ (canary)์ผ๋ก 20% ํธ๋ํฝ
โ VirtualService ๋ฐฐํฌ
kubectl apply -f canary-virtualservice.yaml -n example
โ ํธ๋ํฝ ๋ถ๋ฐฐ ํ์ธ
kubectl get virtualservice -n example
โ ์ถ๋ ฅ ์์:
NAME GATEWAYS HOSTS AGE
example-app <none> example-app.example.svc.cluster.local 1m
๐น 3. Argo CD์ Istio ์ฐ๋ํ์ฌ ๋ฐฐํฌ ์๋ํ
Argo CD๋ฅผ ํ์ฉํ๋ฉด Canary ๋ฐฐํฌ, ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ ์ Istio ์ค์ ์ ์๋ํํ ์ ์์ต๋๋ค.
โ 3.1 Istio ์ค์ ์ ํฌํจํ Argo CD ์ ํ๋ฆฌ์ผ์ด์ ์ ์
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: example-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/repo.git
targetRevision: main
path: istio-config # Istio ์ค์ ์ด ์ ์ฅ๋ Git ๊ฒฝ๋ก
destination:
server: https://kubernetes.default.svc
namespace: example
syncPolicy:
automated:
prune: true
selfHeal: true
โ
์ค๋ช
:
โ path: istio-config → Git ์ ์ฅ์์์ Istio VirtualService๋ฅผ ๊ด๋ฆฌ
โ syncPolicy.automated.prune: true → Git ์ํ์ ๋ค๋ฅด๋ฉด ์๋ ์ ๋ฆฌ
โ syncPolicy.automated.selfHeal: true → Kubernetes ๋ณ๊ฒฝ ์ฌํญ์ ์๋ ๋ณต๊ตฌ
โ Argo CD์์ Canary ๋ฐฐํฌ ๋๊ธฐํ
argocd app sync example-app
โ ๋ฐฐํฌ ์ํ ํ์ธ
argocd app get example-app
โ ์ถ๋ ฅ ์์:
NAME STATUS SYNC STATUS
example-app Healthy Synced
๐น 4. Argo CD์ Istio๋ฅผ ํ์ฉํ ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ
๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ๋ ํ์ฌ ์คํ ์ค์ธ ์๋น์ค(๋ธ๋ฃจ)๋ฅผ ์ ์งํ๋ฉด์ ์๋ก์ด ๋ฒ์ (๊ทธ๋ฆฐ)์ ๋ฐฐํฌํ ํ,
ํ
์คํธ๊ฐ ์๋ฃ๋๋ฉด ๋ชจ๋ ํธ๋ํฝ์ ์๋ก์ด ๋ฒ์ ์ผ๋ก ์ ํํ๋ ๋ฐฉ์์
๋๋ค.
โ 4.1 ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ๋ฅผ ์ํ VirtualService ์ค์
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: example-app
namespace: example
spec:
hosts:
- example-app.example.svc.cluster.local
http:
- route:
- destination:
host: example-app
subset: blue # ๊ธฐ์กด ์๋น์ค
weight: 100 # 100% ํธ๋ํฝ
โ
์ค๋ช
:
โ subset: blue → ๊ธฐ์กด ๋ฒ์ (Blue)์ผ๋ก ๋ชจ๋ ํธ๋ํฝ ์ ์ก
โ 4.2 ์๋ก์ด ๋ฒ์ ๋ฐฐํฌ ํ ํธ๋ํฝ ์ ํ
๋ฐฐํฌ ํ ํธ๋ํฝ์ subset: green ์ผ๋ก ๋ณ๊ฒฝํ์ฌ ์๋ก์ด ๋ฒ์ ์ผ๋ก ์ ํ
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: example-app
namespace: example
spec:
hosts:
- example-app.example.svc.cluster.local
http:
- route:
- destination:
host: example-app
subset: green # ์๋ก์ด ์๋น์ค
weight: 100 # 100% ํธ๋ํฝ ์ ํ
โ
์ค๋ช
:
โ subset: green → ์๋ก์ด ๋ฒ์ (Green)์ผ๋ก ๋ชจ๋ ํธ๋ํฝ ์ ์ก
โ ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ ์ ํ ์คํ
kubectl apply -f blue-green-virtualservice.yaml -n example
โ ํธ๋ํฝ ๋ณ๊ฒฝ ํ์ธ
kubectl get virtualservice -n example -o yaml
โ ์ถ๋ ฅ ์์:
http:
route:
- destination:
host: example-app
subset: green
weight: 100
๐น ๊ฒฐ๋ก : ์ด๋ฒ ๊ธ์์ ๋ฐฐ์ด ํต์ฌ ๋ด์ฉ ์ ๋ฆฌ
๐ข Istio VirtualService๋ฅผ ํ์ฉํ๋ฉด Canary ๋ฐ ๋ธ๋ฃจ-๊ทธ๋ฆฐ ๋ฐฐํฌ๋ฅผ ์ฝ๊ฒ ์ ์ฉ ๊ฐ๋ฅ
๐ข Argo CD์ ์ฐ๋ํ์ฌ Istio ์ค์ ์ ์๋์ผ๋ก ๋ฐฐํฌ ๋ฐ ๊ด๋ฆฌ ๊ฐ๋ฅ
๐ข GitOps ๋ฐฉ์์ ์ ์งํ๋ฉด์ ํธ๋ํฝ ์ ํ ๋ฐ ๋ฐฐํฌ ์ ๋ต์ ์๋ํํ ์ ์์
๐ข ์๋น์ค ๋ฉ์ฌ๋ฅผ ํ์ฉํ์ฌ ๋คํธ์ํฌ ํธ๋ํฝ์ ์ธ๋ฐํ๊ฒ ์ ์ดํ ์ ์์