Is there a new way of recording deployments? ``` k create deploy nginx2 --imag . . .

Allan Olweny:
Is there a new way of recording deployments?

k create deploy nginx2 --image=nginx --record
error: unknown flag: --record
See 'kubectl create deployment --help' for usage.

Vitor Jr.:
Hi @Allan Olweny the --record flag is deprecated for good :disappointed:

Vitor Jr.:
Now, I think the only way would be using an strategy of annotations

Allan Olweny:
Is there a better way of tracking deployments, or figuring out which revision to rollback to? Can someone show me an example?

$ k rollout history deploy/nginx
deployment.apps/nginx 
REVISION  CHANGE-CAUSE
2         <none>
4         <none>
5         <none>
6         <none>

Vitor Jr.:
https://kubernetes.io/docs/reference/labels-annotations-taints/#change-cause

Vitor Jr.:
Looks like the only way (now!) would be using the --record flag

Vitor Jr.:
I’m trying to find more topics about it

Vitor Jr.:
OHHHHHHH I think I found something interesting! :smile:

Vitor Jr.:

Vitor Jr.:
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#checking-rollout-history-of-a-deployment

Vitor Jr.:
Like I said, using annotations @Allan Olweny :slightly_smiling_face:

Allan Olweny:
copy that. might not be a big deal in a ckad exam. Assuming you’d do only on deploy and rollback in a question. But good to know. thanks

Allan Olweny:
worked.

~$ kubectl create deploy nginx --image=nginx --replicas=2
deployment.apps/nginx created
~$ kubectl set image deploy/nginx nginx=nginx:1.19
deployment.apps/nginx image updated
~$ kubectl annotate deploy/nginx <http://kubernetes.io/change-cause='update|kubernetes.io/change-cause='update> image to 1.19'
deployment.apps/nginx annotated
~$ kubectl rollout history deploy/nginx
deployment.apps/nginx 
REVISION  CHANGE-CAUSE
1         &lt;none&gt;
2         update image to 1.19

Vitor Jr.:
Really nice to confirm this @Allan Olweny. Thanks for that, I’m sure more people will benefit from it :slightly_smiling_face:

Allan Olweny:
why didn’t the just let us do this?
--record='update to 1.x'

Allan Olweny:
and set the annotation behind the scenes?

Vitor Jr.:
I read the deprecation note

Vitor Jr.:
It’s complicated, but looks like the way it was implemented was causing problems with new features

Vitor Jr.:
Including security problems

Vitor Jr.: