Is there a Kubernetes rolling upgrade / downgrade finish hook

1/28/2021

When you edit a deployment to update the docker image, I need to run a one-time script which changes parts of my application database and sends an email that the rolling upgrade process is complete and the result is passed / failed.

Is there a hook where I can attach this script to?

-- Devaroop
horizontal-pod-autoscaling
kubernetes

3 Answers

1/28/2021

As far as I know, Kubernetes does not provide anything to support such functionality out of the box but you modify the script to check the status of the rollout using the following command with some sleep:

kubectl rollout status deployment/<deployment-name>
-- Krishna Chaurasia
Source: StackOverflow

1/28/2021

No, there is no such thing in Kubernetes. Usually this should be done by CI/CD pipeline.

-- Vasili Angapov
Source: StackOverflow

1/28/2021

Kubernetes doesn't implement such thing. This can be done by CI/CD pipeline or manually checking rolling update status. As you have said you can write simple script which will check status of rolling update and send it via e-mail and attach it to created pipeline in Jenkins.

To manually check status of rolling update execute command:

$ kubectl rollout status deploy/your-deployment -n your-namespace

If for example you are passing variables using ConfigMap you can use Reloader to perform your rolling updates automatically when a configmap/secret changed.

-- Malgorzata
Source: StackOverflow