You notice that a deployment in your GKE cluster is running an outdated image. You need to update the deployment to use the new image 'gcr.io/my-project/my-app:v2'. Which kubectl command should you use?
kubectl set image deployment/my-deployment my-app=gcr.io/my-project/my-app:v2 is the correct imperative command to update a container image inside a Deployment. The container name (my-app) must exactly match the container name defined in the Deployment's pod spec, and the command updates the pod template so the Deployment controller creates a new ReplicaSet and performs a rolling update. This is the canonical kubectl syntax for changing an image without editing a manifest.
Why this answer
To update the image of a deployment, use 'kubectl set image' specifying the deployment name and the container name:tag.