Deployments¶
A Deployment is the most commonly used workload resource in Kubernetes.
Deployments manage the lifecycle of applications by controlling:
- pod creation
- scaling
- rolling updates
- rollbacks
Why Deployments Exist¶
Running pods directly would require manual management.
Deployments automate this process by ensuring the desired number of pods are always running.
If a pod crashes, Kubernetes automatically replaces it.
Deployment Architecture¶
When a Deployment is created:
- Kubernetes creates a ReplicaSet
- The ReplicaSet creates Pods
- The ReplicaSet ensures the correct number of pods remain running
Rolling Updates¶
One of the most powerful features of Deployments is rolling updates.
This allows applications to update gradually without downtime.
During a rolling update:
- new pods are started
- old pods are terminated gradually
This ensures the application remains available.
Rollbacks¶
If a deployment fails, Kubernetes allows quick rollback to a previous version.
This makes deployments safer and reduces downtime during application updates.
Key Takeaway¶
Deployments provide a declarative way to manage application updates and scaling in Kubernetes.