To delete a Helm deployment in a specific namespace, use the command helm delete RELEASE_NAME --namespace NAMESPACE. This removes the release and its associated Kubernetes resources from that namespace, though the namespace itself remains. If you also want to remove the namespace, you must delete it separately with kubectl delete namespace NAMESPACE.
Background: Helm Releases and Namespaces
Helm is a package manager for Kubernetes that bundles related resources into a single chart. When you install a chart, Helm creates a release — a record of that installation that tracks the resources it created. Releases are scoped to a namespace: the same chart can be installed multiple times in different namespaces, and each installation is a separate release with its own name.
Namespaces provide logical isolation within a Kubernetes cluster. They are commonly used to separate environments (dev, staging, prod) or teams. When you install a Helm chart, you specify the target namespace with --namespace (or -n). If you don’t, Helm uses the namespace from your current kubeconfig context, which is often default.
How Helm Delete Works
Running helm delete RELEASE_NAME --namespace NAMESPACE performs the following:
- It looks up the release in the specified namespace.
- It deletes all Kubernetes resources that were created by that release (Deployments, Services, ConfigMaps, etc.).
- It removes the release record from Helm’s storage (usually a Secret in the same namespace).
- It does not delete the namespace itself, nor any resources not created by the release (e.g., manually created PersistentVolumes).
The command is idempotent: if the release doesn’t exist, Helm returns an error like Error: release: not found. To suppress that error, you can use --ignore-not-found (available in Helm 3.7+).
How to Choose the Right Command
Decide whether you need to delete just the release or also the namespace. Use this decision tree:
- If you want to remove the application but keep the namespace (e.g., for future installs), use
helm delete RELEASE_NAME -n NAMESPACE. - If you want to remove everything including the namespace, run
helm delete RELEASE_NAME -n NAMESPACEfollowed bykubectl delete namespace NAMESPACE. - If you want to delete multiple releases in the same namespace, you can loop:
helm ls -n NAMESPACE -q | xargs -L1 helm delete -n NAMESPACE.
Note that deleting a namespace will delete all resources inside it, not just those from Helm. If the namespace contains other workloads, deleting it will remove them too.
Common Problems and How to Avoid Them
Here are typical issues you might encounter:
- Wrong namespace specified: If you omit
--namespace, Helm uses the current context’s namespace, which may not be the one where the release lives. Always check withhelm list -n NAMESPACE. - Release stuck in “pending-uninstall”: If a previous delete failed, the release may be stuck. You can retry with
helm delete RELEASE_NAME -n NAMESPACE --force(Helm 3) or manually clean up the release secret. - Resources left behind: If the chart uses
hooksor resources withpreserveannotations, they may not be deleted. Check withkubectl get all -n NAMESPACE. - Namespace deletion hangs: A namespace stuck in
Terminatingstate often has finalizers from resources like PersistentVolumeClaims or custom resources. You may need to remove those finalizers manually.
Comparison: Helm Delete vs kubectl Delete
Using kubectl delete deployment myapp -n NAMESPACE deletes only that Deployment object. It does not remove the Helm release record, so Helm still thinks the release exists. If you then run helm list, the release will appear as deployed even though its resources are gone. This can cause confusion and broken upgrades. Always prefer helm delete for Helm-managed resources.
In contrast, helm delete understands the chart’s dependencies and cleans up all resources that were created by the chart, including Services, ConfigMaps, and Secrets. It also removes the release record, so Helm’s state is consistent.
Safety and Best Practices
Before deleting a release, consider these safety steps:
- Take a backup of any important data, especially if the chart uses PersistentVolumeClaims. Deleting a release does not delete PVCs by default, but deleting the namespace will.
- Use
helm get manifest RELEASE_NAME -n NAMESPACEto see exactly what resources will be deleted. - If you are unsure about the impact, use
helm delete RELEASE_NAME -n NAMESPACE --dry-runto see what would happen without actually deleting. - In production, consider using a GitOps workflow (like Argo CD or Flux) to manage releases, so deletions are reviewed and tracked.
Frequently Asked Questions
Does helm delete delete the namespace?
No. helm delete only removes the release and its resources. The namespace remains. To delete the namespace, run kubectl delete namespace NAMESPACE separately.
How do I delete a Helm release without deleting the namespace?
Simply run helm delete RELEASE_NAME --namespace NAMESPACE. This is the default behavior; it does not touch the namespace.
What if I don’t know the namespace of a release?
You can list all releases across all namespaces with helm list --all-namespaces. The output will show the namespace for each release. Then use that namespace in your delete command.
How do I delete a Helm release and all its PersistentVolumeClaims?
Helm does not delete PVCs by default because they may contain data you want to keep. To delete them, you must do it manually: first delete the release, then run kubectl delete pvc -l app.kubernetes.io/instance=RELEASE_NAME -n NAMESPACE (or a similar label selector depending on the chart). Alternatively, delete the entire namespace, which will remove all PVCs in it.
Can I delete a Helm release from a different namespace than the current context?
Yes. Use the --namespace flag to specify the namespace explicitly. For example: helm delete myapp --namespace staging. This works even if your current context is set to another namespace.
What is the difference between helm delete and helm uninstall?
They are the same command. helm uninstall is an alias for helm delete in Helm 3. Both remove the release and its resources.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Channel TLD Websites: What They Are & How to Get One5.00 min/km
- Django Class Based Views CRUD REST API
- Most Secure OS for Privacy: 3 Picks by Device
- Ryobi One+ Battery System: Is the Switch Worth It?
- Tmux Terminal Upgrade: Is It Worth It?
- Gst registration and return filing checklist for small businesses in india?