apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- bluegreen.yaml
- ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: canary-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: canary-ingress
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: canary-service
servicePort: 80
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: canary-rollout
spec:
replicas: 3
revisionHistoryLimit: 2
selector:
matchLabels:
app: canary
template:
metadata:
labels:
app: canary
spec:
containers:
- name: canary-rollouts-demo
image: particule/simplecolorapi:1.0
imagePullPolicy: Always
ports:
- containerPort: 5000
# 이 부분에서 카나리로 지정
strategy:
canary:
maxSurge: "25%"
maxUnavailable: 0
steps:
- setWeight: 25
- pause: { duration: 30 }
---
kind: Service
apiVersion: v1
metadata:
name: canary-service
spec:
selector:
app: canary
ports:
- protocol: TCP
port: 80
targetPort: 5000
nodePort: 30081
type: NodePort
maxSurge # canary 배포로 생성할 pod의 비율
maxUnavailable # 업데이트 될 때 사용할 수 없는 pod의 최대 수
setWeight # 카나리로 배포된 서버로 전송해야될 트래픽 비율
pause: {} # AutoPromotion Time
- pause: { duration: 30 } # 30초 - pause: { duration: 30s } # 30초 - pause: { duration: 30m } # 30분 - pause: { duration: 30h } # 30시간 - pause: {} # Auto Promotion 옵션 비활성화 - pause: { duration: -10 } # 잘못된 옵션