Deployment Strategies in Kubernetes (Deployment Strategies) 🚀

Study notes for CKA/CKAD certification.

1. Rolling Update (The Standard) 🔄

  • Behavior: Incremental update. Kubernetes creates Pods of the new version (v2) and removes those of the old one (v1) little by little.
  • Pros: No downtime (Zero Downtime).
  • Cons: During the process, two versions of the app (v1 and v2) coexist at the same time.
  • Use: The default strategy of the Deployments.

2. Canary Deployment (The Canary in the Mine) 🐤

  • Behavior: You deploy the new version (v2) to a very small subset of users (or traffic) while the rest remain on the v1.
  • Goal: Validate positive logs and metrics (“if the canary survives”) before propagating the update to 100% of clients.
  • Pros: Minimizes the impact if the new version has bugs.
  • Implementation: It is usually done with a Service Mesh (Istio/Linkerd) or controlling manual replicas.

3. Blue/Green Deployment (Blue/Green) 🔵🟢

  • Behavior: You have two identical environments.
    • Blue (Active): It has the v1 receiving all traffic.
    • Green (Inactive): You display the complete v2 here.
  • The Switch: When Green is ready and tested, you change the balancer to point 100% at Green. Then you turn off Blue.
  • Pros: Instant rollback (you only return the switch).
  • Cons: Expensive (you need twice as many resources/hardware temporarily).

4. Recreate (The Switch) 🔌

  • Behavior: Turn off all old Pods (v1) Wait Turn on new ones (v2).
  • Pros: Clean condition. Two versions never coexist.
  • Cons: Downtime. The service goes down while the change is made.
  • Use: Only when the app does not support running two versions at the same time (e.g. conflicting DB migrations).