Question 31
Domain 2: Application Deployment and WorkloadsWhich kubectl command is used to check a Deployment's rollout history and verify the replica status?
Correct answer: A
Explanation
`kubectl rollout history deployment/<name>` shows the Deployment’s rollout revisions, which is how you check rollout history. `kubectl get deployment <name>` displays the Deployment status, including the replica counts, so it verifies whether the desired and available replicas match.
Why each option is right or wrong
A. kubectl rollout history deployment/<name> && kubectl get deployment <name>
`kubectl rollout history deployment/<name>` is the Kubernetes subcommand that queries the Deployment’s recorded revision history, which is stored in the Deployment object’s rollout annotations and revision history. To verify replica status, `kubectl get deployment <name>` returns the live Deployment status fields, including `DESIRED`, `CURRENT`, `UP-TO-DATE`, and `AVAILABLE` replica counts, which are the values used to confirm whether the rollout has completed successfully.
B. kubectl describe pod <name> && kubectl logs <name>
C. kubectl get rs --watch && kubectl edit service <name>
D. kubectl scale deployment <name> --replicas=0 && kubectl rollout undo deployment/<name>