Advertisement
Advanced .NET, CI/CD, Publishing & Deployment

What is the difference between blue-green deployment and canary deployment, and how do they apply to .NET applications?

Short answer

Blue-green deployment maintains two identical production environments (blue = current, green = new), routing all traffic to green only after it's fully deployed and verified, enabling instant rollback by switching traffic back to blue if issues arise.

Save .NET mock interview
Advertisement
AModel answer
Blue-green deployment maintains two identical production environments (blue = current, green = new), routing all traffic to green only after it's fully deployed and verified, enabling instant rollback by switching traffic back to blue if issues arise. Canary deployment instead gradually shifts a small percentage of traffic to the new version, monitoring for errors before progressively increasing that percentage -- reducing blast radius of a bad deployment compared to blue-green's all-at-once cutover, at the cost of more complex traffic-splitting infrastructure.
# Canary deployment via Kubernetes traffic splitting
apiVersion: split.smi-spec.io/v1alpha3
kind: TrafficSplit
spec:
  service: myapp
  backends:
    - service: myapp-v1
      weight: 90
    - service: myapp-v2
      weight: 10  # only 10% of traffic hits the new version initially
Real-world example
A payments API uses canary deployment, routing 5% of traffic to a new version for an hour while monitoring error rates and latency, only proceeding to 100% rollout if no anomalies are detected, versus a less risk-averse internal tool that uses simpler blue-green cutover.
Likely follow-ups
  • How do you automate canary rollback based on error rate thresholds?
  • What infrastructure is needed to support traffic splitting for canary deployments?
Related topics