0
0
Kubernetesdevops~10 mins

Deployment status and history in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Deployment status and history
Create Deployment
Kubernetes Controller creates Pods
Pods start running
Check Deployment Status
View Deployment History
Update Deployment (optional)
New ReplicaSet created
Old ReplicaSet scaled down
Deployment status updated
This flow shows how a Kubernetes Deployment is created, how pods are managed, how status is checked, and how history is tracked through ReplicaSets.
Execution Sample
Kubernetes
kubectl create deployment nginx --image=nginx
kubectl rollout status deployment/nginx
kubectl rollout history deployment/nginx
kubectl set image deployment/nginx nginx=nginx:1.19
kubectl rollout status deployment/nginx
This sequence creates an nginx deployment, checks its status, views its history, updates the image, and checks status again.
Process Table
StepCommandActionResult/Output
1kubectl create deployment nginx --image=nginxCreate deployment named nginx with nginx imagedeployment.apps/nginx created
2kubectl rollout status deployment/nginxCheck rollout status of nginx deploymentdeployment "nginx" successfully rolled out
3kubectl rollout history deployment/nginxView rollout history of nginx deploymentREVISION CHANGE-CAUSE 1 <none>
4kubectl set image deployment/nginx nginx=nginx:1.19Update nginx container image to version 1.19deployment.apps/nginx image updated
5kubectl rollout status deployment/nginxCheck rollout status after updatedeployment "nginx" successfully rolled out
6kubectl rollout history deployment/nginxView updated rollout historyREVISION CHANGE-CAUSE 1 <none> 2 kubectl set image deployment/nginx nginx=nginx:1.19
7kubectl rollout undo deployment/nginxRollback to previous revisiondeployment.apps/nginx rolled back
8kubectl rollout status deployment/nginxCheck rollout status after rollbackdeployment "nginx" successfully rolled out
💡 Deployment is successfully rolled out or rolled back, no further updates.
Status Tracker
VariableStartAfter Step 1After Step 4After Step 7Final
Deployment Imagenonenginx:latestnginx:1.19nginx:latestnginx:latest
Deployment Revisionnone1211
Deployment StatusnoneRolled outRolled outRolled outRolled out
Key Moments - 3 Insights
Why does the rollout history show multiple revisions?
Each deployment update creates a new revision tracked in rollout history, as seen in steps 3 and 6 where revision 1 and 2 appear.
What does 'kubectl rollout status' tell us?
It shows if the deployment is successfully rolled out or still updating, as shown in steps 2, 5, and 8 where it confirms success.
How does rollback affect the deployment image?
Rollback restores the deployment image to the previous revision's image, shown in variable_tracker where image changes back to nginx:latest after step 7.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table at step 4. What change happens to the deployment?
AThe deployment is deleted
BThe deployment image is updated to nginx:1.19
CThe deployment is scaled to zero pods
DThe deployment status is checked
💡 Hint
Refer to the 'Action' and 'Result/Output' columns at step 4 in the execution table.
At which step does the deployment rollback occur?
AStep 5
BStep 3
CStep 7
DStep 2
💡 Hint
Look for the command 'kubectl rollout undo' in the execution table.
According to the variable tracker, what is the deployment image after step 7?
Anginx:latest
Bnginx:1.19
Cnone
Dnginx:1.20
💡 Hint
Check the 'Deployment Image' row under 'After Step 7' in the variable tracker.
Concept Snapshot
kubectl create deployment NAME --image=IMAGE  # Create deployment
kubectl rollout status deployment/NAME       # Check rollout status
kubectl rollout history deployment/NAME      # View deployment revisions
kubectl set image deployment/NAME CONTAINER=IMAGE  # Update image
kubectl rollout undo deployment/NAME          # Rollback to previous revision
Deployment status shows if pods are running as expected; history tracks changes.
Full Transcript
This visual execution traces Kubernetes deployment status and history commands. First, a deployment named nginx is created with the nginx image. The rollout status command confirms the deployment is running successfully. Rollout history shows the initial revision. Then, the deployment image is updated to nginx:1.19, creating a new revision. Status is checked again to confirm success. History now shows two revisions. A rollback command restores the deployment to the previous image and revision. The final status confirms the rollback succeeded. Variables tracked include deployment image, revision number, and status, showing how they change after each command. Key moments clarify why multiple revisions appear, what rollout status means, and how rollback affects the deployment image. Quiz questions test understanding of update, rollback, and variable states referencing the execution table and variable tracker.