Deployments
Deployments provide declarative updates to Pods and ReplicaSets, enabling rolling updates and rollbacks.
Deployment - Rolling Update
v1.0
v2.0
Gradual pod replacement
Mental Model
A Deployment is like a software version controller for pods. It manages multiple versions of your application, allowing smooth transitions between versions with automatic rollback if something goes wrong.
YAML Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-deployment
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.21Common Misconceptions
- ✗Deployments directly manage pods - FALSE: They manage ReplicaSets
- ✗Deployments require manual updates - FALSE: Declarative updates
- ✗Rollbacks are difficult - FALSE: One command to rollback
Key Takeaways
- • Deployments provide declarative updates to Pods and ReplicaSets, enabling rolling updates and rollbacks.
- • A Deployment is like a software version controller for pods. It manages multiple versions of your ap...
- • Check the YAML example for implementation details
- • Be aware of the common misconceptions listed above