Question 36
Domain 2: Application Deployment and WorkloadsWhich kubectl command intentionally updates a deployment to use the wrong image nginx:1.91?
Correct answer: A
Explanation
`kubectl set image` is the command used to change a workload’s container image, and the syntax is `deployment/<deployment-name> <container-name>=<image>`. Using `nginx:1.91` in that assignment intentionally updates the deployment to the wrong image.
Why each option is right or wrong
A. kubectl set image deployment/<deployment-name> <container-name>=nginx:1.91
`kubectl set image` is the subcommand that patches the Pod template of a Deployment by changing the container image field, and the required syntax is `kubectl set image deployment/<name> <container>=<image>`. In this case, assigning `nginx:1.91` to the named container updates the Deployment’s `.spec.template.spec.containers[].image` value to that exact tag, which is the only way among the listed command forms to deliberately point the workload at the incorrect image.
B. kubectl create deployment <deployment-name> --image=nginx:1.91
C. kubectl rollout restart deployment/<deployment-name> --image=nginx:1.91
D. kubectl edit pod/<pod-name> image=nginx:1.91