Leave behind all doubts and fears. For the path ahead is filled with grace.
- Replication Controller and Replica Set don’t provide the updates and rollback for the application in the cabinets cluster. But in a deployment, the object does.
- The deployment object works as a supervisor for the pods which gives granular control over the pods.
- Deployment objects can decide how and when the pods should be deployed, rollback or updated.
- In Deployment, we define the desired state and the deployment controller will help to achieve the desired state from the current state. You can achieve this by declarative(manifest) method only.?
- Deployment object supports rollback which means if the app is crashing in a new update then you can easily switch to the previous version by rollback.
- The deployment object doesn’t work directly with the pods. Under the deployment object, there will be a replica set or replica controller that manages the pods and helps to manage the desired state.
- With the help of deployment, the replica set will be rolled out, which will deploy the pods and check the status in the background whether the rollout has succeeded or not.
- If the pod template spec is modified then, the new replica set will be created with the new desired state and the old replica set will still exist and you can roll back according to the situation.
- You can roll back to the previous deployment if the current state of the deployment is not stable.
- You can scale up the deployment to manage the loads.
- You can pause the deployment if you are fixing something in between the deployment and then resume it after fixing it.
- You can clean up those replica sets which are older and no longer needed.
create deployment : kubectl apply -f my-deployment.yml
get deployment: kubectl get deploy
For ex, you might have added 2 replicas earlier and you need to scale them to 4, you can run below
scale deployment: kubectl scale --replicas=4 deployment my-deployment
roll out deployment: kubectl rollout undo deployment deployment-name
for ex: kubectl rollout undo deployment my-deployment
delete deployment: kubectl delete -f my-deployment.yml
Happy learning && thanks for your time in reading.
#kubernetesLearning #deployment #rollout #rollback