What are the main Deployment Strategies for microservices?

Topic: microservices, Deployment. Level: Intermediate.

Answer

- **Rolling**: replace instances gradually; no downtime, but mixed versions run briefly. - **Blue-Green**: run the new version (green) alongside old (blue), switch traffic at once; instant rollback, but doubles resources. - **Canary**: route a small % of traffic to the new version, watch metrics, then ramp up; limits blast radius. - **Shadow/dark launch**: send mirrored traffic to the new version without serving its responses, to test under real load. Pair with automated health checks and rollback. Backward-compatible APIs/schemas are required so old and new can coexist. ```yaml # Canary: 10% to v2, 90% to v1 (e.g. Istio VirtualService) http: - route: - destination: { host: orders, subset: v1 } weight: 90 - destination: { host: orders, subset: v2 } weight: 10 # ramp to 100 as metrics stay green ```