I tried kubectl rollout history deployment/my-app
, it returns only No rollout history found.
I think there exists a method to get all the deploy histories. It will be very helpful.
Reference official document: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
One can use -o option to change output format. Examples: # View the last-applied-configuration annotations by type/name in YAML. kubectl apply view-last-applied deployment/nginx # View the last-applied-configuration annotations by file in JSON kubectl apply view-last-applied -f deploy.
Creating a Deployment Setting the kubectl flag --record to true allows you to record current command in the annotations of the resources being created or updated. It will be useful for future introspection; for example, to see the commands executed in each Deployment revision.
After the kubectl apply command you can check if the deployment rolled out successfully or not and then, if necessary, the kubectl rollout undo command can rollback to the previous revision. Also, you can use the sleep Linux command to wait some time before that.
When kubectl describe pod does not show any information about an error, we can use another kubectl command, that is, logs . The kubectl logs command allows us to print container logs, and we can also view them in real time as well.
Use --record
while creating the deployment so that it will start recroding the deployment into the ReplicaSet.
$ kubectl create -f deploy.yaml --record=true
Whenever you deploy new version of deployment, the replica set preserves the previous configuration of the deployment. Check the track of deployment and even we can use this for automation. This should be the default option in the kuberentes deployment, but, by default it's set to false.
Then check the status and history using the below commands,
$ kubectl rollout status deploy myapp-deployment
$ kubectl rollout history deploy myapp-deployment
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With