Interview Prep/CI/CD/Release Engineering and Progressive Delivery

How do you implement a canary release with Argo Rollouts and automated analysis?

AdvancedProductionRelease Engineering and Progressive Delivery
Answer

Replace the Deployment with a Rollout that defines canary steps and an AnalysisTemplate querying Prometheus for the canary's success rate. If the analysis fails, Argo Rollouts aborts and rolls back to stable automatically.

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata: { name: success-rate }
spec:
  metrics:
    - name: success-rate
      interval: 1m
      count: 5
      successCondition: result[0] >= 0.99
      failureLimit: 1
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: |
            sum(rate(http_requests_total{app="shop-api",status!~"5.."}[2m]))
            / sum(rate(http_requests_total{app="shop-api"}[2m]))

Traffic splitting needs an ingress or mesh integration (NGINX, ALB, Istio, Gateway API) for precise percentages; without one, weight is approximated by pod ratio.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Release Engineering and Progressive Delivery