A hook Job keeps failing with "already exists" on the second deploy. Why?
BeginnerScenarioHooks, Migrations & Testing
Answer
Situation read → The first run's Job still exists, and Jobs are immutable, so Helm cannot create a new one with the same name.
What I'd do →
- Add
"helm.sh/hook-delete-policy": before-hook-creation. - Delete the stale Job once:
kubectl delete job shop-migrate -n shop.
Why → before-hook-creation removes the previous instance before each run.
Interview tip → Note it is the default only when no delete policy annotation is set.
More on Hooks, Migrations & Testing
Design database migrations for a Helm-deployed app where the database is a subchart.IntermediateThe migration Job takes 12 minutes on prod data and the upgrade times out. What do you change?IntermediateA migration hook failed and the Job pod was deleted, so you cannot see why. How do you fix the chart?BeginnerYou want a backup before every production upgrade. How do you do it with Helm?IntermediateA `post-install` hook seeds demo data; it ran again on every upgrade and duplicated rows. Why?IntermediateHow do you clean up external resources (DNS records, S3 buckets) when a release is uninstalled?Advanced