Interview Prep/Helm/Hooks, Tests, GitOps & Secrets

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

IntermediateTroubleshootingHooks, Tests, GitOps & Secrets
Answer

Likely causes → The hook Job is still running (long migration), stuck waiting for the DB, cannot schedule (resources, node selectors), or its pod never finishes because of a sidecar.

Diagnose →

kubectl get pods -n shop -l job-name=shop-migrate -o wide
kubectl describe pod -n shop -l job-name=shop-migrate | sed -n '/Events/,$p'
kubectl logs -n shop -l job-name=shop-migrate -c migrate

Fix → Address the cause; increase --timeout if the migration is legitimately slow; disable sidecar injection or use native sidecars for hook pods.

Prevent → activeDeadlineSeconds on hook Jobs; keep migrations fast.

All Helm questions Roadmap: Helm

More on Hooks, Tests, GitOps & Secrets