Home > OS >  helm post-upgrade hook running before all pods upgraded
helm post-upgrade hook running before all pods upgraded

Time:10-27

I am very confused by helm post-upgrade hook. The documentation says: Executes on an upgrade request after all resources have been upgraded.

But I am seeing that hook starts even when all the pods in the deployment are not yet updated.

I created and upgraded a chart and the hook is running almost the same time the first pod starts. Here are timestamps for the chart:

Test 1: Pre-upgrade hook Started: Tue, 25 Oct 2022 15:51:29 0530 Finished: Tue, 25 Oct 2022 15:51:41 0530

Post-upgrade hook Started: Tue, 25 Oct 2022 15:51:46 0530 Finished: Tue, 25 Oct 2022 15:51:58 0530

Pod 2 Started: Tue, 25 Oct 2022 15:52:10 0530

Pod 1 Started: Tue, 25 Oct 2022 15:52:15 0530

Pod 0 Started: Tue, 25 Oct 2022 15:52:20 0530

Test 2: Post-upgrade hook Started: Tue, 25 Oct 2022 16:03:50 0530

Pod 2 Started: Tue, 25 Oct 2022 16:03:54 0530

Pod 1 Started: Tue, 25 Oct 2022 16:04:00 0530

Pod 0 Started: Tue, 25 Oct 2022 16:04:05 0530

As we can see in below image, the hook goes into container-creating state even as main pods are in terminating/container-creating state. enter image description here

helm itself says it is in "pending-upgrade" state. enter image description here

What am I missing here? How do I run a pod once all the replicas have been updated to newer image? Thanks.

CodePudding user response:

Executes on an upgrade request after all resources have been upgraded.

A kubernetes deployment can be "upgraded" and return before all the pods have been cycled. This does sound like the situation you are running into here. Are you using --wait as part of your helm install/upgrade?

  • Related