Part 2: Deployment Strategies
When a Simple Deploy Nearly Took Down My System
Rolling Updates: The Kubernetes Default
How Rolling Updates Work
My Production Rolling Update Configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-service
namespace: production
spec:
replicas: 6
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2 # Can have 2 extra pods during update
maxUnavailable: 1 # At most 1 pod can be unavailable
selector:
matchLabels:
app: api-service
template:
metadata:
labels:
app: api-service
version: v2.5.1
spec:
containers:
- name: api
image: myregistry/api-service:v2.5.1
ports:
- containerPort: 8080
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
readinessProbe:
httpGet:
path: /health/ready
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: /health/live
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3When I Use Rolling Updates
Watching the Rollout
Blue/Green Deployments: Zero-Downtime Switching
My First Blue/Green Success
Implementing Blue/Green with Kubernetes Services
When I Use Blue/Green
Canary Deployments: Testing with Real Traffic
The Canary That Saved Us
Implementing Canaries with ArgoCD and Kubernetes
Automated Canary with Prometheus Metrics
Monitoring Canary Progress
When I Use Canary Deployments
Rollback Strategies: When Things Go Wrong
Kubernetes Built-in Rollback
GitOps Rollback with ArgoCD
Emergency Rollback Procedure I Use
Database Rollbacks: The Hard Part
Comparison: Which Strategy When?
Strategy
Rollback Speed
Risk Level
Infrastructure Cost
Best For
Lessons Learned from Failed Deployments
Lesson 1: Health Checks Are Critical
Lesson 2: Resource Limits Prevent Cascading Failures
Lesson 3: Monitor During and After Deployment
Lesson 4: Practice Rollbacks
Key Takeaways
Last updated