Currently the lecture Demo – Deployments – Update and Rollback https://kodekloud.com/topic/demo-deployments-update-and-rollback/
is still teaching the use of --record. Using this flag triggers a warning that this feature is deprecated and will be removed in future versions. Looking over the discussions on Github, this has been in the works since 2018, so no idea how long it’ll still work.
This hasnt been changed. Can you let me know if there is an alternative?
any alternative of --record ?
Hi @cyb3rx,
The --record
flag is deprecated but can be still use. The aims of this flag are to add an annotation to describe the change did on the resource. You can add it manually as workaround
kubectl create deployment nginx --image=nginx:1.16 --replicas 2 #create the deployment
kubectl set image deployment nginx nginx=nginx:1.17 #set image without --record
kubectl set image deployment nginx nginx=nginx:1.18 --record #set image with --record
kubectl set image deployment nginx nginx=nginx:latest #set image without --record
kubectl annotate deployments nginx kubernetes.io/change-cause="set image to nginx latest" #Annotate the last record
you can do now
kubectl rollout history deployment nginx
You can see on the result that :
- revision 1 & 2 doesn’t have Change cause
- revision 3 have change cause due to --record
- revision 4 have change cause due to annotation
1 Like
There’s a discussion about it here. You can set the change-cause
manually like this kubectl annotate deployment/nginx-deploy kubernetes.io/change-cause=’rolled back to rev 3'