Delete Helm Deployment & Namespace {How-To}

If unwanted or multiple copies of Helm deployments exist, there is a way to delete them and free up space. On the other hand, deleting a Kubernetes cluster namespace removes the components along with the namespace.

This article explains how to delete a Helm deployment and namespace.

Deleting a Helm deployment removes the components without deleting the namespace.

Important note: Multiple Helm releases with the same name can coexist on different namespaces. Make sure to find the exact deployment and namespace before deleting it.

List Helm deployments in the current namespace with:

To list deployments in a specific namespace, use:

List all Helm deployments in all namespaces by running:

The example above shows deployments of the same name existing on different namespaces. Find the exact release and the namespace, and proceed to the next step.

To remove an installed Helm deployment, run:

Alternatively, use the alias:

The terminal outputs a confirmation of removal. For example, the command below removes a deployment named phoenix-chart on the namespace other:

In Helm 2, use the --purge option to delete the release and related Kubernetes components:

List Helm deployments with helm list to confirm the release is no longer there.

Delete Helm Deployment and Namespace

Deleting the namespace also deletes all the residing components. However, removing all deployments within a namespace does not remove the namespace.

Although there is an option to generate a namespace when deploying a chart with --create-namespace, there is no method to remove it when deleting a release using Helm commands. Delete the namespace using the kubectl command.

List all namespaces with:

The output prints all the namespaces, their status, and age:

To delete a namespace and all the components, run:

The terminal prints a confirmation message. For example, to remove the other namespace:

The namespace no longer appears on the list and is available for use again.

Removing a Helm deployment or namespace requires careful consideration. Make sure to check which component you are deleting before removing anything.

Next, consider learning how to use Helm environment variables for Helm charts. Using Helm environment variables helps define the Kubernetes environment.

Originally published at https://phoenixnap.com on March 11, 2021.

save Your Data! — juandisay.org

save Your Data! — juandisay.org