You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Deploying software to production is the final — and most critical — stage of a CI/CD pipeline. The deployment strategy you choose determines how much risk you take, how fast you can roll back, and how users experience changes.
A poor deployment strategy can cause:
A good deployment strategy provides:
Stop the old version, deploy the new version.
v1 ████████████████ STOP
START v2 ████████████████
↑ Downtime ↑
| Aspect | Details |
|---|---|
| Downtime | Yes — during the switch |
| Complexity | Very low |
| Rollback | Redeploy old version |
| Cost | Lowest |
| Use case | Development environments, non-critical services |
Gradually replace instances of the old version with the new version.
| Aspect | Details |
|---|---|
| Downtime | None |
| Complexity | Low |
| Rollback | Roll forward or reverse the rolling update |
| Cost | Low (uses existing infrastructure) |
| Use case | Default for most Kubernetes deployments |
# Kubernetes rolling update configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
spec:
containers:
- name: myapp
image: myapp:v2.0.0
readinessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
Run two identical environments: Blue (current) and Green (new). Switch traffic after validation.
graph TD
subgraph Before["Before switch"]
T1["Traffic"] --> LB1["Load Balancer"]
LB1 --> B1["Blue (v1) — ACTIVE"]
LB1 --> G1["Green (v2) — STANDBY"]
end
subgraph After["After validation: switch traffic to Green"]
T2["Traffic"] --> LB2["Load Balancer"]
LB2 --> B2["Blue (v1) — STANDBY"]
LB2 --> G2["Green (v2) — ACTIVE"]
end
Before -.->|"switch"| After
| Aspect | Details |
|---|---|
| Downtime | None |
| Complexity | Medium |
| Rollback | Instant — switch traffic back to Blue |
| Cost | Higher (double infrastructure during deploy) |
| Use case | Critical applications requiring instant rollback |
Route a small percentage of traffic to the new version. Gradually increase if metrics look good.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.