시작하기 - App Mesh
이 가이드는 Argo Rollouts가 AWS App Mesh가 관리하는 service-meshes와 어떻게 통합되는지 설명해요. 이 가이드는 기본 시작하기 가이드의 개념을 바탕으로 진행해요.
출처: 문서
본문
이 가이드는 Argo Rollouts가 AWS App Mesh가 관리하는 service-meshes와 어떻게 통합되는지 설명해요. 이 가이드는 기본 시작하기 가이드의 개념을 바탕으로 진행해요.
Requirements
- K8s용 AWS App Mesh Controller가 설치된 Kubernetes 클러스터
Tip
Kubernetes에서 App Mesh를 사용하는 방법은 App Mesh Controller 설치 안내를 참고해요.
1. Deploy the Rollout, Services, App Mesh CRD
App Mesh가 트래픽 라우터로 사용될 때, Rollout canary 전략은 다음 필수 필드를 정의해야 해요:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: my-rollout
spec:
strategy:
canary:
# canaryService and stableService are references to Services which the Rollout will modify
# to target the canary ReplicaSet and stable ReplicaSet respectively (required).
canaryService: my-svc-canary
stableService: my-svc-stable
trafficRouting:
appMesh:
# The referenced virtual-service will be used to determine the virtual-router that is
# manipulated to update canary weights.
virtualService:
# name of the virtual-service App Mesh CR
name: my-svc
# Optional set of routes to update. If empty, all routes associated with the virtual-service are updated.
routes:
- http-primary
# virtualNodeGroup is a structure to refer App Mesh virtual-node CR corresponding to Canary and Stable versions
virtualNodeGroup:
# canaryVirtualNodeRef refers to virtual-node corresponding to canary version. Rollouts controller will
# update the podSelector of this virtual-node to latest canary pod-hash generated by controller.
canaryVirtualNodeRef:
name: my-vn-canary
# stableVirtualNodeRef refers to virtual-node corresponding to stable version. Rollouts controller will
# update the podSelector of this virtual-node to latest stable pod-hash generated by controller.
stableVirtualNodeRef:
name: my-vn-stable
steps:
- setWeight: 25
- pause: {}
...
이 가이드에서 두 서비스는 각각 my-svc-canary와 my-svc-stable이에요. 이 서비스에 대응하는 두 개의 virtual-node CR이 있으며 이름은 각각 my-vn-canary와 my-vn-stable이에요. 또한 rollout-demo-vrouter라는 virtual-router CR이 제공하는 rollout-demo-vsvc라는 virtual-service가 있어요. 이 virtual-router에는 canary와 stable virtual-node로 트래픽을 전달하는 action이 있는 라우트가 최소 하나 있어야 해요. 처음에는 canary의 가중치가 0%, stable의 가중치가 100%로 설정돼요. 롤아웃 중에 컨트롤러는 steps[N].setWeight에 정의된 구성을 기반으로 라우트의 가중치를 수정해요.
canary와 stable 서비스는 headless로 구성돼요. 이는 Pod가 canary에서 stable로 재할당될 때 App Mesh가 connection pooling을 제대로 처리할 수 있도록 하기 위해 필요해요.
요약하면 다음 명령을 실행해 서비스를 배포해요:
-
두 개의 서비스 (stable과 canary)
-
하나의 서비스 (VIP 및 DNS 조회용)
-
두 개의 App Mesh virtual-node (stable과 canary)
-
virtual-node로 가는 라우트가 있는 하나의 App Mesh virtual-router
-
VIP 서비스에 대응하는 하나의 App Mesh virtual-service
-
하나의 rollout
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/examples/appmesh/canary-service.yaml
kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-rollouts/master/examples/appmesh/canary-rollout.yaml
2. Verify service
먼저 rollout이 안정적인지 확인해요.
kubectl argo rollouts get rollout my-rollout -n argo-examples -w
그런 다음 서비스가 정상 동작하는지 확인해요.
kubectl -n argo-examples port-forward svc/my-svc 8181:80
3. Rollout new version
이제 새 버전을 배포할 시간이에요. 새로운 이미지로 rollout을 업데이트해요.
kubectl argo rollouts set image my-rollout demo=argoproj/rollouts-demo:green -n argo-examples
Rollout은 새 canary revision을 배포하고 virtual-router 아래의 가중치를 업데이트해야 해요.
kubectl get -n argo-examples virtualrouter my-vrouter -o json | jq ".spec.routes[0].httpRoute.action.weightedTargets"
[
{
"virtualNodeRef": {
"name": "my-vn-canary"
},
"weight": 25
},
{
"virtualNodeRef": {
"name": "my-vn-stable"
},
"weight": 75
}
]
이제 무기한 일시 중지된 rollout을 수동으로 승인하고, 라우트가 업데이트되는 것을 계속 지켜봐요.
kubectl argo rollouts promote my-rollout -n argo-examples
watch -d 'kubectl get -n argo-examples virtualrouter my-vrouter -o json | jq ".spec.routes[0].httpRoute.action.weightedTargets"'