10 / 67 · 06 Observability-Driven Testing · Canary Deployments← prev⊞ allnext →☰ Read as one page
2.4Canary with Argo Rollouts (Kubernetes-Native)
For teams not using Spinnaker, Argo Rollouts provides Kubernetes-native canary deployments:
# argo-canary-rollout.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: checkout-service
spec:
replicas: 10
strategy:
canary:
canaryService: checkout-canary
stableService: checkout-stable
trafficRouting:
istio:
virtualService:
name: checkout-vsvc
routes:
- primary
steps:
- setWeight: 5 # 5% to canary
- pause: { duration: 5m }
- analysis:
templates:
- templateName: canary-analysis
args:
- name: service-name
value: checkout-service
- setWeight: 25 # 25% to canary
- pause: { duration: 10m }
- analysis:
templates:
- templateName: canary-analysis
- setWeight: 50 # 50% to canary
- pause: { duration: 10m }
- analysis:
templates:
- templateName: canary-analysis
- setWeight: 100 # promote canary to stable
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: canary-analysis
spec:
metrics:
- name: error-rate
interval: 1m
successCondition: result < 0.01
provider:
prometheus:
address: http://prometheus.monitoring:9090
query: |
sum(rate(http_requests_total{status=~"5..",app="checkout",
rollouts-pod-template-hash="{{args.canary-hash}}"}[5m]))
/
sum(rate(http_requests_total{app="checkout",
rollouts-pod-template-hash="{{args.canary-hash}}"}[5m]))
- name: latency-p99
interval: 1m
successCondition: result < 0.5
provider:
prometheus:
address: http://prometheus.monitoring:9090
query: |
histogram_quantile(0.99, sum(rate(
http_request_duration_seconds_bucket{app="checkout",
rollouts-pod-template-hash="{{args.canary-hash}}"}[5m])) by (le))