Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Kubernetes & Helm Difficulty: Intermediate ClaudeChatGPT

Helm Chart Hooks & Lifecycle Design Prompt

Design Helm lifecycle hooks correctly — pre-install migrations, post-upgrade jobs, weights, deletion policies, and the wait-for-completion traps that hang or orphan releases.

Target user
Chart authors wiring migrations and lifecycle jobs into Helm releases
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior chart author who has shipped production charts with database migrations, cache warmups, and cleanup jobs wired through Helm hooks — and debugged every way they hang.

I will provide:
- The chart and what lifecycle action I need (DB migration, schema check, cache prime, external registration, cleanup)
- When it must run (before workloads, after upgrade, only on first install, on delete)
- The job/command it runs and roughly how long it takes
- Symptoms if existing (release stuck, hook re-runs, orphaned Jobs, migration ran twice)

Guide me through this:

1. **Choose the hook** — map my need to the right `helm.sh/hook`: `pre-install`, `post-install`, `pre-upgrade`, `post-upgrade`, `pre-delete`, `post-delete`, `pre-rollback`, `post-rollback`, `test`. Be explicit about which fire on install-only vs every upgrade.

2. **Weights & ordering** — explain `helm.sh/hook-weight` (lower runs first, sorted as strings — mind "10" vs "2"), and how to sequence a migration Job before a config Secret.

3. **Deletion policy** — `helm.sh/hook-delete-policy`: `before-hook-creation` (default-ish, cleans the prior run), `hook-succeeded`, `hook-failed`. Explain how the wrong policy leaves orphaned Jobs or makes a re-run fail with "already exists".

4. **The blocking trap** — Helm waits for a hook Job to reach Complete before proceeding. A Job with no `backoffLimit`, a crash-looping pod, or a missing `restartPolicy: Never` hangs the whole release. Give a safe Job template.

5. **Idempotency** — hooks can re-run on every upgrade; make migrations idempotent or guard them (e.g., a migration tool that tracks applied versions). Never assume "runs once".

6. **Failure handling** — what happens to the release when a `pre-upgrade` hook fails (the upgrade aborts; the old release may be left in a pending state); how to recover; `--wait`/`--timeout` interplay.

7. **Hooks vs not-hooks** — when a plain Job or an init container or an Argo PreSync is a better fit than a Helm hook.

Output as: (a) a recommendation of which hook(s) and weights to use, (b) the annotated hook Job template (with `restartPolicy: Never`, `backoffLimit`, `activeDeadlineSeconds`), (c) the delete-policy choice and why, (d) an idempotency strategy for my specific job, (e) a recovery runbook for a stuck hook.

Bias toward: idempotent, bounded, self-cleaning hooks; never let a hook hang a release indefinitely.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Kubernetes & Helm prompts & error guides

Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.