I'm new to k8s. I want to specify my own change cause with rollouts. I know I can use the --record:
kubectl set image deployment/tomcat-deployment tomcat=tomcat:9.0.1 --record
But I'd like to specify my own change cause (e.g. "Update to Tomcat 9.0.1"
I tried this:
kubectl annotate deployment tomcat-deployment kubernetes.io/change-cause='Tomcat9.0.1
'
but it changes the change cause the whole kubectl annotate command above
is there a way to do this?
Thanks
Mark
There is no K8s tool to help you do this. If you want to add annotations to keep the track of what you are doing to can do it through patches as follows:
kubectl patch RESOURCE RESOURCE_NAME --patch '{"metadata": {"annotations": {"my-annotation-key": "my-annotation-value"}}}'
So, if you would want to add an annotation to a deployment, you would do:
kubectl patch deployment tomcat-deployment --patch '{"metadata": {"annotations": {"tomcat-deployment kubernetes.io/change-cause": "Tomcat9.0.1"}}}'
Now, I don't think this is a good approach. I personally would never do this. The best way may be would be to have a CI/CD implemented (jenkins, ansible) and keep the track through commits.