Deployment
Last updated
Was this helpful?
Last updated
Was this helpful?
In production, you usually only create deployment definition yml file (no need for pod definition and replica set definition). Because deployment automatically create replicate set and pod, so you have all their benefits and extra benefit of deployment as follow:
Upgrade seamlessly by rolling update
Roll back when necessary
Pause, make changes and resume so that the changes are rolled out together. These changes are multiple command such as upgrading the underlying web server version and modify resource allocation. So you do not want to apply the changes immediately after each command
Deployment is higher rank than the replica set.
Rollout and Versioning
When you are doing deployment, under the hood you are triggering a roll-out that create a new deployment revision (Revision 1, 2 and so on). This numbering helps us keep track of versioning and in case a roll-back is necessary.
There are 2 deployment strategy:
Recreate - destroy all pods and then subsequently bring back all at once. Downside is application is down.
Rolling update (default) - upgrading seamlessly one by one
Update your deployment
Once you make necessary changes to the definition file, run command
kubectl run nginx --image=nginx command is actually not just creating pod, but create deployment. You can do deployment this way, but the recommended way is to use definition file for easier revision in the future.