Question 4
Domain 2: Application Deployment and WorkloadsWhich kubectl command performs a rolling restart of Deployment `restart-app` in namespace `q40` without changing its spec and then allows you to verify a new rollout revision?
Correct answer: A
Explanation
`kubectl rollout restart deployment/restart-app -n q40` triggers a rolling restart by updating the Deployment’s pod template annotation, so it restarts pods “without changing its spec.” `kubectl rollout status deployment/restart-app -n q40` then watches the rollout so you can verify the new revision has completed.
Why each option is right or wrong
A. kubectl rollout restart deployment/restart-app -n q40 && kubectl rollout status deployment/restart-app -n q40
`kubectl rollout restart` is the Kubernetes 1.15+ subcommand that triggers a restart by patching the workload’s pod template metadata (an annotation change), which causes a new ReplicaSet and rollout without altering the Deployment’s declared spec. The follow-up `kubectl rollout status deployment/restart-app -n q40` watches that rollout to completion in namespace `q40`, confirming the new revision has progressed successfully rather than merely issuing the restart request.
B. kubectl delete pods -l app=restart-app -n q40 && kubectl get rollout deployment/restart-app -n q40
C. kubectl scale deployment/restart-app --replicas=0 -n q40 && kubectl scale deployment/restart-app --replicas=3 -n q40
D. kubectl edit deployment/restart-app -n q40 --record