Resource annotation in kuberneties

I have create deployment mydeploy1 with two replicas with image nginx:1.20 , Then upgrade image to nginx1:21. I would like to record version upgrade in resource annotation .

Is this the correct way. Please let me know.

controlplane $ kubectl set image deployment mydeploy1 iginx=nginx:1.22 –record
Flag --record has been deprecated, --record will be removed in the future
deployment.apps/mydeploy1 image updated
controlplane $ kubectl rollout history deployment mydeploy1
deployment.apps/mydeploy1
REVISION CHANGE-CAUSE
1
2
3
4 kubectl set image deployment mydeploy1 iginx=nginx:1.21 --record=true
5 kubectl set image deployment mydeploy1 iginx=nginx:1.22 --record=true

controlplane $

If yes , why it’s showing – Flag --record has been deprecated,

It’s been deprecated for years, but for its main uses, hasn’t really been adequately replaced. So the message keeps playing on, but people keep using it. Apparently it’s hard to maintain, but also hard to replace.