Skip to content
LatchkeyLatchkey home

helm uninstall: Command Reference for CI/CD

Remove a release and the resources it created.

helm uninstall deletes a release and the objects Helm installed for it. In CI it tears down per-PR preview environments. This reference covers the flags that control history retention and blocking behaviour.

Common flags and usage

  • uninstall <release>: delete the release and its resources
  • --namespace <ns>: scope to the release namespace
  • --keep-history: retain release history for later inspection
  • --wait: block until resources are fully removed
  • --ignore-not-found: do not error if the release is absent (idempotent)

Example

shell
helm uninstall web-pr-${PR_NUMBER} \
  --namespace previews --ignore-not-found --wait

In CI

Use --ignore-not-found so a teardown job is idempotent and does not fail when the release was already removed. --wait ensures resources are gone before the step returns, which matters if you then delete the namespace. uninstall does not remove a namespace it did not create.

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

Key takeaways

  • --ignore-not-found keeps teardown jobs idempotent.
  • --wait blocks until resources are actually gone.
  • uninstall does not delete a namespace it did not create.

Frequently asked questions

helm uninstall: Command Reference for CI/CD?
helm uninstall deletes a release and the objects Helm installed for it. In CI it tears down per-PR preview environments. This reference covers the flags that control history retention and blocking behaviour.
In CI?
Use --ignore-not-found so a teardown job is idempotent and does not fail when the release was already removed. --wait ensures resources are gone before the step returns, which matters if you then delete the namespace. uninstall does not remove a namespace it did not create.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card