Updating Argo Rollouts

Kubernetes Progressive Delivery Controller

Progressive Delivery는 제품의 업데이트를 제어하고 점진적인 방식으로 릴리스하는 프로세스로, 일반적으로 자동화와 메트릭 분석을 결합하여 업데이트의 자동 승격 또는 롤백을 유도합니다.

Progressive Delivery은 CI/CD에서 제공하는 속도 이점을 구축 프로세스로 확장하는 continuous delivery의 발전으로 설명되기도 합니다. 이는 새 버전의 노출을 사용자 하위 집합에 제한하고 올바른 동작을 관찰 및 분석한 다음, 정확성을 지속적으로 검증하면서 더 넓고 광범위한 대상자에 대한 노출을 점진적으로 증가시킴으로써 가능합니다.

Argo Rollouts는 Kubernetes 컨트롤러이자 CRD 집합으로, Blue/green과 canary 배포 및 분석, 실험 및 Kubernetes에 대한 점진적 제공 기능과 같은 고급 배포 기능을 제공합니다.

Argo Rollouts은 수신 컨트롤러 및 서비스 메시와 통합되어 트래픽 조절 기능을 활용하여 업데이트 중에 트래픽을 점차 새 버전으로 전환합니다. 또한 다양한 공급자의 메트릭을 쿼리하고 해석하여 주요 KPI를 확인하고 업데이트 중에 자동화된 프로모션 또는 롤백을 수행할 수 있습니다.

  • Blue/Green 업데이트 전략

  • Canary 업데이트 전략

  • 세분화된 트래픽 제어

  • 자동 롤백 및 프로모션

  • 사용자 지정 가능한 메트릭 쿼리 및 비즈니스 KPI 분석

  • Ingress controller : NGINX, ALB

  • 서비스 메시 : Istio, Linkerd, SMI

  • Metric : Prometeus, Wavefront, Kayenta, Web, Kubernetes Jobs, Datadog, New Relic, Graphite

본 실습은 Argo rollout 의 Basic usage를 활용하였습니다.

https://argoproj.github.io/argo-rollouts/getting-started/

1. Argo Rollouts 설치

Quick start로 Rollout Controller를 설치합니다. Controller가 동작할 argo-rollouts 네임스페이스를 생성합니다.

mkdir ~/environment/argo-rollout-demo
cd ~/environment/argo-rollout-demo

kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml

kubectl 플러그인 를 설치합니다. kubectl 플러그인은 선택 사항이지만 명령줄에서 롤아웃을 관리하고 시각화하는 데 편리합니다.

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

아래 명령어로 rollouts이 설치되었는지 확인합니다.

kubectl argo rollouts version

Ingress Controller (AWS Load Balancer Controller)를 가이드에 따라 설치합니다.

2. 실습 환경 구경

실습에 필요한 yaml 파일을 다운로드 받습니다.

curl -Lo rollout.yaml https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/alb/rollout.yaml
curl -Lo service.yaml https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/alb/services.yaml
curl -Lo ingress.yaml https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/alb/ingress.yaml
curl -Lo bluegreen.yaml https://raw.githubusercontent.com/argoproj/argo-rollouts/master/docs/getting-started/basic/rollout.yaml

파일 rollout.yaml, service.yaml, ingress.yaml, bluegreen.yaml 이렇게 4개 파일이 있어야 합니다.

rollout.yaml 파일을 보면 아래와 같이 canary strategy가 정의되어 있습니다.

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollouts-demo
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: rollouts-demo-canary
      stableService: rollouts-demo-stable
      trafficRouting:
        alb:
          # The referenced ingress will be injected with a custom action annotation, directing
          # the AWS Load Balancer Controller to split traffic between the canary and stable
          # Service, according to the desired traffic weight (required).
          ingress: rollouts-demo-ingress
          # Reference to a Service that the Ingress must target in one of the rules (optional).
          # If omitted, uses canary.stableService.
          rootService: rollouts-demo-root
          # Service port is the port which the Service listens on (required).
          servicePort: 443
...

다운 받은 3개의 파일을 적용합니다.

kubectl apply -f rollout.yaml
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml

설치 이후 아래 명령어로 확인합니다.

kubectl get ro
kubectl get svc
kubectl get ingress

rollout을 통하여 현재 배포 상태를 확인합니다.

kubectl argo rollouts get rollout rollouts-demo

3. Canary 배포 수행

image를 변경하여 rollout에 대한 업데이트를 수행합니다.

kubectl argo rollouts set image rollouts-demo rollouts-demo=argoproj/rollouts-demo:yellow
kubectl argo rollouts get rollout rollouts-demo

이 시점에서는 Canary 및 stable 버전의 원격 설치가 모두 실행 중이며 트래픽의 5%가 Canary로 향합니다. 이 방법이 어떻게 작동하는지 이해하려면, ALB에 listener rule을 확인합니다.

콘솔의 EC2->load balancer 에서 생성된 ALB를 선택합니다. 그리고 하단 탭의 리스너에서 규칙보기/편집을 클릭합니다.

아래 명령어를 수행하여 정지되어 있는 배포를 완료합니다.

kubectl argo rollouts promote rollouts-demo

kubectl argo rollouts get rollout rollouts-demo

Last updated