Error: UPGRADE FAILED: pre-upgrade hooks failed: timed out waiting for the condition

11/5/2020

I am testing a pre-upgrade hook which just has a bash script that prints a string and sleep for 10 mins. When I run helm upgrade, it ran for some time and exited with the error in the title. I used kubectl to check the job and it was still running. Any idea on how to get rid of the error?

Thanks

The script in the container that the job runs:

#!/bin/bash

echo "Sleeping for testing..."
sleep 600
-- Fan Zhang
kubernetes
kubernetes-helm
kubernetes-jobs

1 Answer

11/5/2020

Use --timeout to your helm command to set your required timeout, the default timeout is 5m0s.

$ helm install <name> <chart> --timeout 10m30s

--timeout: A value in seconds to wait for Kubernetes commands to complete. This defaults to 5m0s (5 minutes).

Helm documentation: https://helm.sh/docs/intro/using_helm/#helpful-options-for-installupgraderollback

-- Kamol Hasan
Source: StackOverflow