Use the kubectl set command allows us to overwrite the spec.template.spec.containers[].image property that is similar to using the kubectl run command to specify the image file. The following example specifies my-nginx deployment to set the container my-nginx to change the image to nginx version 1.12.0:
$ kubectl set image deployment my-nginx my-nginx=nginx:1.12.0 --recorddeployment.apps "my-nginx" image updated$ kubectl describe deploy my-nginxName: my-nginx……Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True ReplicaSetUpdatedOldReplicaSets: my-nginx-54bb7bbcf9 (3/3 replicas created)NewReplicaSet: my-nginx-77769b7666 (1/1 replicas created) ...