ArgoRollouts with Istio

문학적인유사성·2023년 8월 21일
0

뎁옵깃옵쿠베

목록 보기
38/46
post-thumbnail

공식문서 Rollout 컨셉

설치

공식문서 가이드

# 네임스페이스 생성
kubectl create namespace argo-rollouts


# agro-rollouts 설치
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml

customresourcedefinition.apiextensions.k8s.io/analysisruns.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/analysistemplates.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/clusteranalysistemplates.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/experiments.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/rollouts.argoproj.io created
serviceaccount/argo-rollouts created
clusterrole.rbac.authorization.k8s.io/argo-rollouts created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-admin created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-edit created
clusterrole.rbac.authorization.k8s.io/argo-rollouts-aggregate-to-view created
clusterrolebinding.rbac.authorization.k8s.io/argo-rollouts created
configmap/argo-rollouts-config created
secret/argo-rollouts-notification-secret created
service/argo-rollouts-metrics created
deployment.apps/argo-rollouts created

# 확인
kubectl get all -n argo-rollouts

# argo-rolleouts CLI 설치
curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
chmod +x ./kubectl-argo-rollouts-linux-amd64
sudo mv ./kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts
kubectl argo rollouts version
kubectl get all -n argo-rollouts

# 또는  MAC 최고!! 이래서 맥을 못버리지...
brew install argoproj/tap/kubectl-argo-rollouts
kubectl argo rollouts versionㄴ

배포

공식문서 istio 배포 가이드
argo rollout 참고 가이드
참고블로그 0

  • istio-vsvc.yaml
14.argorollout % kubectl apply -f istio-vsvc.yaml -n test
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
 name: rollout-vsvc
spec:
 gateways:
 - argo-gateway
 hosts:
 - "*"
 http:
 - name: primary  # referenced in canary.trafficRouting.istio.virtualService.routes
   route:
   - destination:
       host: test-app-old # referenced in canary.stableService
     weight: 90
   - destination:
       host: test-app-new # referenced in canary.canaryService
     weight: 10
  • istio-gw.yaml
14.argorollout % kubectl apply -f istio-gw.yaml  -n test
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
 name: argo-gateway
spec:
 selector:
   istio: ingressgateway # use the default IngressGateway
 servers:
 - port:
     number: 80
     name: http
     protocol: HTTP
   hosts:
   - "*"
  • istio-rollout.yaml
14.argorollout % kubectl apply -f rollout-istio.yaml -n test
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
 name: rollout-istio
spec:
 replicas: 2
 revisionHistoryLimit: 2
 selector:
   matchLabels:
     app: rollout-istio
 template:
   metadata:
     labels:
       app: rollout-istio
   spec:
     containers:
     - name: yusa-app
       image: ${본인 ECR}:v1
       imagePullPolicy: Always
       ports:
       - containerPort: 5000
 strategy:
   canary:
     canaryService: test-app-new  # required
     stableService: test-app-old  # required
     trafficRouting:
       istio:
         virtualService:
           name: rollout-vsvc   # required
           routes:
           - primary            # optional if there is a single route in VirtualService, required otherwise
     steps:
     - setWeight: 50 # overrides the weight provided in virtualservice
     - pause:
         duration: 3m
---
apiVersion: v1
kind: Service
metadata:
 name: test-app-old
spec:
 selector:
   app: rollout-istio
 ports:
   - protocol: "TCP"
     port: 80
     targetPort: 5000
 type: ClusterIP

---
apiVersion: v1
kind: Service
metadata:
 name: test-app-new
spec:
 selector:
   app: rollout-istio
 ports:
   - protocol: "TCP"
     port: 80
     targetPort: 5000
 type: ClusterIP

확인

14.argorollout % kubectl argo rollouts get rollout rollout-istio -n test
Name:            rollout-istio
Namespace:       test
Status:          ✔ Healthy
Strategy:        Canary
  Step:          2/2
  SetWeight:     100
  ActualWeight:  100
Images:          ${본인 ECR}:v1 (stable)
Replicas:
  Desired:       2
  Current:       2
  Updated:       2
  Ready:         2
  Available:     2

NAME                                       KIND        STATUS     AGE  INFO
⟳ rollout-istio                            Rollout     ✔ Healthy  84s  
└──# revision:1                                                        
   └──⧉ rollout-istio-5596978fd6           ReplicaSet  ✔ Healthy  14s  stable
      ├──□ rollout-istio-5596978fd6-4jltp  Pod         ✔ Running  14s  ready:2/2
      └──□ rollout-istio-5596978fd6-w6w9z  Pod         ✔ Running  14s  ready:2/2

Rollout 개시

kubectl argo rollouts set image rollout-istio yusa-app=${본인 ECR}:v2 -n test

14.argorollout % kubectl argo rollouts get rollout rollout-istio -n test                                                        
Name:            rollout-istio
Namespace:       test
Status:          ॥ Paused
Message:         CanaryPauseStep
Strategy:        Canary
  Step:          1/2
  SetWeight:     50
  ActualWeight:  50
Images:          ${본인 ECR}:v1 (stable)
                 ${본인 ECR}:v2 (canary)
Replicas:
  Desired:       2
  Current:       3
  Updated:       1
  Ready:         3
  Available:     3

NAME                                       KIND        STATUS     AGE  INFO
⟳ rollout-istio                            Rollout     ॥ Paused   17m  
├──# revision:2                                                        
│  └──⧉ rollout-istio-b5dbf54b9            ReplicaSet  ✔ Healthy  14s  canary
│     └──□ rollout-istio-b5dbf54b9-gh29s   Pod         ✔ Running  14s  ready:2/2
└──# revision:1                                                        
   └──⧉ rollout-istio-5596978fd6           ReplicaSet  ✔ Healthy  16m  stable
      ├──□ rollout-istio-5596978fd6-4jltp  Pod         ✔ Running  16m  ready:2/2
      └──□ rollout-istio-5596978fd6-w6w9z  Pod         ✔ Running  16m  ready:2/2

좀 시간이 지나면~~~
이렇게 화면에서 동시에 나오기 시작한다.

14.argorollout % kubectl argo rollouts get rollout rollout-istio -n test
Name:            rollout-istio
Namespace:       test
Status:          ✔ Healthy
Strategy:        Canary
  Step:          2/2
  SetWeight:     100
  ActualWeight:  100
Images:          ${본인 ECR}:v2 (stable)
Replicas:
  Desired:       2
  Current:       2
  Updated:       2
  Ready:         2
  Available:     2

NAME                                       KIND        STATUS         AGE    INFO
⟳ rollout-istio                            Rollout     ✔ Healthy      21m    
├──# revision:2                                                              
│  └──⧉ rollout-istio-b5dbf54b9            ReplicaSet  ✔ Healthy      3m55s  stable
│     ├──□ rollout-istio-b5dbf54b9-gh29s   Pod         ✔ Running      3m55s  ready:2/2
│     └──□ rollout-istio-b5dbf54b9-7crx9   Pod         ✔ Running      50s    ready:2/2
└──# revision:1                                                              
   └──⧉ rollout-istio-5596978fd6           ReplicaSet  • ScaledDown   20m    
      ├──□ rollout-istio-5596978fd6-4jltp  Pod         ◌ Terminating  20m    ready:2/2
      └──□ rollout-istio-5596978fd6-w6w9z  Pod         ◌ Terminating  20m    ready:2/2
      
14.argorollout % kubectl argo rollouts get rollout rollout-istio -n test
Name:            rollout-istio
Namespace:       test
Status:          ✔ Healthy
Strategy:        Canary
  Step:          2/2
  SetWeight:     100
  ActualWeight:  100
Images:          ${본인 ECR}:v2 (stable)
Replicas:
  Desired:       2
  Current:       2
  Updated:       2
  Ready:         2
  Available:     2

NAME                                      KIND        STATUS        AGE    INFO
⟳ rollout-istio                           Rollout     ✔ Healthy     23m    
├──# revision:2                                                            
│  └──⧉ rollout-istio-b5dbf54b9           ReplicaSet  ✔ Healthy     6m37s  stable
│     ├──□ rollout-istio-b5dbf54b9-gh29s  Pod         ✔ Running     6m37s  ready:2/2
│     └──□ rollout-istio-b5dbf54b9-7crx9  Pod         ✔ Running     3m32s  ready:2/2
└──# revision:1                                                            
   └──⧉ rollout-istio-5596978fd6          ReplicaSet  • ScaledDown  22m <= 이걸 보시라!!!

Dashboard

  1. ArgoRollout Dashboard
kubectl argo rollouts dashboard

  1. Kiali Dashboard
    키알리에서도 확인이 가능하다.!

0개의 댓글