DevOps Bootcamp · Lesson

What Hooks Are and When They Fire

pre-install, post-upgrade, and the full event set.

Lesson 1 of 413 steps

What Hooks Are and When They Fire is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.

Why Hooks Exist

Sometimes you need work done at a precise moment in a release, like seeding a database. A Helm hook runs a resource at a chosen lifecycle event.

A Hook Is Just Annotated

A hook is an ordinary Kubernetes manifest with one extra annotation. The helm.sh/hook annotation tells Helm to treat it specially instead of as normal release content.

metadata:
  annotations:
    "helm.sh/hook": pre-install

The install Events

Two events fire around a fresh install. pre-install runs before any chart resources are created, and post-install runs after they are applied.

"helm.sh/hook": pre-install

The upgrade Events

Upgrades have their own pair. pre-upgrade fires before the upgrade is applied, and post-upgrade fires once the new resources are in place.

"helm.sh/hook": pre-upgrade,post-upgrade

The rollback Events

Rolling back to an earlier revision also triggers hooks. pre-rollback runs before the revert and post-rollback runs after the old state returns.

The delete Events

Uninstalling fires the delete pair. pre-delete runs before resources are removed, giving you a window to drain or back things up first.

"helm.sh/hook": pre-delete

The test Event

One more event is special. The test hook does not fire on install; it runs only when you call helm test against an existing release.

"helm.sh/hook": test

Hooks Are Often Jobs

Most hooks are a Kubernetes Job, since a Job runs to completion and reports success. Helm waits for that Job before moving the release forward.

kind: Job
metadata:
  annotations:
    "helm.sh/hook": post-install

Helm Waits for Success

For each weight, Helm waits until the hook resource reaches its ready state before continuing. A failed hook stops the whole install or upgrade.

Outside Normal Tracking

Hook resources live outside the release's normal lifecycle. They are not upgraded with the chart, so you manage their cleanup with separate delete policies.

Combine Several Events

One resource can serve more than one moment. List events together, like post-install,post-upgrade, so the same Job runs after both a fresh install and an upgrade.

"helm.sh/hook": post-install,post-upgrade

Quick Check

You want a Job to run after a fresh chart is installed for the first time.

Recap

Hooks are annotated manifests that fire at lifecycle events: install, upgrade, rollback, delete, and test. Helm waits for each one to succeed. 🪝

Free to start

Learn DevOps Bootcamp with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
142
Lessons
568

Frequently Asked Questions

Is the “What Hooks Are and When They Fire” lesson free?

Yes — any 3 lessons of the DevOps Bootcamp learning path, including “What Hooks Are and When They Fire”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.

What will I learn in “What Hooks Are and When They Fire”?

pre-install, post-upgrade, and the full event set. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “What Hooks Are and When They Fire” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Hooks Are and When They Fire
  2. A Database Migration pre-upgrade Job
  3. Hook Weights and Ordering
  4. Hook Deletion Policies
← Back to DevOps Bootcamp