After this lesson, you will be able to: Compare rollback, canary, and blue/green deployment strategies and pick the right one for your team.
Deploying isn't enough; deploying SAFELY is. This lesson covers the three deploy patterns mature teams use.
Every deploy needs a one-command rollback. Web on Vercel / Netlify: built-in via the dashboard or `vercel rollback`. Kubernetes: `kubectl rollout undo deployment/myapp` or `helm rollback`. Docker on VPS: keep the previous image tag pinned; redeploy with old SHA. Practice the rollback during a quiet day. Knowing the muscle memory is half the value.
Two complete production stacks: blue (current) and green (new). Deploy to green; smoke test; switch the load balancer / DNS / Ingress to point at green. Blue still runs in case you need to roll back instantly. Trade-off: doubles infrastructure cost during the switch. Best for: critical systems, low-frequency deploys, big risky changes.
Send 1% of traffic to the new version; watch metrics; if healthy, ramp to 10%, 50%, 100%. Stops bad deploys early, 99% of users see the old (good) version while the 1% catches the bug. Requires: traffic-shifting infrastructure (Ingress with weighted routes, Service Mesh, or a CDN that splits). Best for: high-frequency deploys, large user bases where 1% is meaningful traffic.
ingress-nginx supports canary annotations natively.
# canary-deployment.yaml: deploy v2 as a separate DeploymentapiVersion: apps/v1kind: Deploymentmetadata: { name: myapp-canary }spec:replicas: 1 # keep small until rampingselector: { matchLabels: { app: myapp, version: v2 } }template:metadata: { labels: { app: myapp, version: v2 } }spec:containers: [{ name: web, image: myapp:v2 }]---apiVersion: v1kind: Servicemetadata: { name: myapp-canary }spec:selector: { app: myapp, version: v2 }ports: [{ port: 80, targetPort: 3000 }]---apiVersion: networking.k8s.io/v1kind: Ingressmetadata:name: myapp-canaryannotations:nginx.ingress.kubernetes.io/canary: "true"nginx.ingress.kubernetes.io/canary-weight: "10" # 10% of trafficspec:ingressClassName: nginxrules:- host: example.comhttp:paths:- path: /pathType: Prefixbackend:service: { name: myapp-canary, port: { number: 80 } }
No rollback practice. The first time you try is during an outage; you forget the command. Canary without observability. Without metrics, the canary is a coin flip. Blue/green without DB migration discipline. The green env reads/writes the SAME DB; backwards-incompatible migrations break blue. Treating canary % as 'good enough' without time. 1% for 1 minute catches nothing; 1% for 1 hour catches real issues. Skipping feature flags. Most rollback scenarios are flag flips waiting to happen.
Pick the one with the fastest abort path.
Sign in and purchase access to unlock this lesson.