Kubectl apply annotation for rollback history
The great thing about Kubernetes is the declarative nature of the YAML files you write to describe your deployments. You can always be sure that your deployment will match what’s in your YAML. More often than not, i’m hacking something together and submitting my deployments to Kubernetes incrementally by changing my YAML file and then performing a kubectl apply command. As such, I don’t get a lot of information in my history. EG. if I run kubectl rollout history deployments
then the change-cause is just empty.
I’ve been going through a hack, where rollbacks have become a critical part of the exercise – so felt this needed more exploration. I wanted to start getting an annotation coming through to serve as a quick change log. Here’s how I did it.
kubectl apply -f contentweb.yaml<br />
kubectl annotate deployment content-web kubernetes.io/change-cause="my release note" --record=false --overwrite=true<br />
kubectl rollout history deployments