Skip to content
LatchkeyLatchkey home

helmfile destroy: Uninstall All Releases

helmfile destroy runs helm uninstall for every release in the helmfile, tearing the whole stack down.

For ephemeral preview environments, destroy is the cleanup step: it removes every release the helmfile created.

What it does

helmfile destroy uninstalls all releases defined in the current helmfile (honoring the selected environment and any selector). It is the inverse of sync. It does not delete the namespace itself unless a release managed it.

Common usage

Terminal
# tear down a preview environment
helmfile -e "pr-$PR_NUMBER" destroy
# remove only one labeled group
helmfile destroy --selector app=api

Options

FlagWhat it does
-e, --environment <name>Select the environment to destroy
--selector key=valueDestroy only matching releases
--skip-chartsSkip the chart prepare/build phase

In CI

Run destroy in a cleanup job when a pull request closes so preview namespaces do not accumulate. Use the same -e environment name you deployed with so destroy targets exactly that stack. destroy is safe to re-run: missing releases are skipped.

Common errors in CI

"Error: uninstall: Release not loaded: ...: release: not found" on a release that was never installed is benign and helmfile generally continues. If destroy leaves PVCs or CRDs behind, that is expected: helm does not delete PVCs from StatefulSets or CRDs by default. A stuck namespace usually has a finalizer on a leftover resource.

Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes

Frequently asked questions

helmfile destroy: Uninstall All Releases?
For ephemeral preview environments, destroy is the cleanup step: it removes every release the helmfile created.
What it does?
helmfile destroy uninstalls all releases defined in the current helmfile (honoring the selected environment and any selector). It is the inverse of sync. It does not delete the namespace itself unless a release managed it.
In CI?
Run destroy in a cleanup job when a pull request closes so preview namespaces do not accumulate. Use the same -e environment name you deployed with so destroy targets exactly that stack. destroy is safe to re-run: missing releases are skipped.
Common errors in CI?
"Error: uninstall: Release not loaded: ...: release: not found" on a release that was never installed is benign and helmfile generally continues. If destroy leaves PVCs or CRDs behind, that is expected: helm does not delete PVCs from StatefulSets or CRDs by default. A stuck namespace usually has a finalizer on a leftover resource.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card