Argo-rollouts Install

# argo-rollouts의 namespace 생성
$ kubectl create namespace argo-rollouts

# manifest 파일 이용하여 argo-rollouts 설치
$ kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml

Argo-rollouts Plugin Install

# 다운로드
$ 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-argo-rollouts: v1.0.2+7a23fe5
  BuildDate: 2021-06-15T19:36:00Z
  GitCommit: 7a23fe5dbf78181248c48af8e5224246434e7f99
  GitTreeState: clean
  GoVersion: go1.16.3
  Compiler: gc
  Platform: linux/amd64

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - bluegreen.yaml
  - ingress.yaml

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ontheair-ingress
  annotations:
    alb.ingress.kubernetes.io/certificate-arn: <ACM arn>
    alb.ingress.kubernetes.io/healthcheck-path: /
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP": 80}]'
    alb.ingress.kubernetes.io/target-type: ip
    kubernetes.io/ingress.class: alb
  labels:
    app: ontheair-ingress
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: rollout-bluegreen-active
              servicePort: 80
  • ingress.yaml로 ALB 생성 확인

bluegreen.yaml

apiVersion: argoproj.io/v1alpha1     
kind: Rollout  
metadata:
  name: rollout-bluegreen
spec:
  replicas: 2
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: rollout-bluegreen
  template:
    metadata:
      labels:
        app: rollout-bluegreen
    spec:
      containers:
      - name: rollouts-demo
        # image: argoproj/rollouts-demo:blue
        image: argoproj/rollouts-demo:green
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
  strategy:
    blueGreen: 

      activeService: rollout-bluegreen-active
      
      previewService: rollout-bluegreen-preview
      
      autoPromotionEnabled: true

---
kind: Service
apiVersion: v1
metadata:
  name: rollout-bluegreen-active
spec:
  selector:
    app: rollout-bluegreen
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  type: NodePort
---
kind: Service
apiVersion: v1
metadata:
  name: rollout-bluegreen-preview
spec:
  selector:
    app: rollout-bluegreen
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  type: NodePort

remark

  • apps/v1 대신 argoproj.io/v1alpha1을 사용
  • Deplyment 대신 Rollout을 사용
  • autoPromotioEnabled 옵션은 Blue/Green 배포를 자동으로 진행할 것인지 여부. false 옵션을 사용해 수동으로 지정

Blue/Green 전환

Argo CD Rollouts Dashboard

With GUI

# GUI
kubectl argo rollouts dashboard

# INFO[0000] Argo Rollouts Dashboard is now available at localhost 3100
# EC2 Public IP:3100 로 접속

With CLI

# CLI
kubectl argo rollouts get rollout rollout-bluegreen --watch

0개의 댓글