How to Delete A Helm Release?

9 minutes read

To delete a Helm release, you can follow these steps:

  1. Determine the name of the release you want to delete. You can use the command helm list to see all the releases and their names.
  2. Run the command helm delete RELEASE_NAME, where RELEASE_NAME is the name of the release you want to delete. This command will send a delete request to Kubernetes, which will remove all the resources associated with the release.
  3. By default, Helm will mark the release for deletion and remove the resources in the background. You can use the --purge flag to delete the release and its associated resources immediately. For example, helm delete --purge RELEASE_NAME.
  4. You can verify the deletion of the release by running helm list again. If the release is not listed, it has been successfully deleted.
  5. If you want to delete all the releases in a namespace, you can use the helm delete --purge --all command. This will delete all releases in the current namespace.


Note: Deleting a release does not automatically delete any persistent volumes associated with it. You might need to delete them manually if required.

Best Kubernetes Books to Read in 2024

1
Kubernetes: Up and Running: Dive into the Future of Infrastructure

Rating is 5 out of 5

Kubernetes: Up and Running: Dive into the Future of Infrastructure

2
Kubernetes in Action

Rating is 4.9 out of 5

Kubernetes in Action

3
The Book of Kubernetes: A Complete Guide to Container Orchestration

Rating is 4.8 out of 5

The Book of Kubernetes: A Complete Guide to Container Orchestration

4
The Kubernetes Operator Framework Book: Overcome complex Kubernetes cluster management challenges with automation toolkits

Rating is 4.7 out of 5

The Kubernetes Operator Framework Book: Overcome complex Kubernetes cluster management challenges with automation toolkits

5
Kubernetes: Up and Running: Dive into the Future of Infrastructure

Rating is 4.6 out of 5

Kubernetes: Up and Running: Dive into the Future of Infrastructure

6
Kubernetes Cookbook

Rating is 4.5 out of 5

Kubernetes Cookbook

7
Mastering Kubernetes - Fourth Edition: Dive into Kubernetes and learn how to create and operate world-class cloud-native systems

Rating is 4.4 out of 5

Mastering Kubernetes - Fourth Edition: Dive into Kubernetes and learn how to create and operate world-class cloud-native systems

8
Mastering Kubernetes: Level up your container orchestration skills with Kubernetes to build, run, secure, and observe large-scale distributed apps, 3rd Edition

Rating is 4.3 out of 5

Mastering Kubernetes: Level up your container orchestration skills with Kubernetes to build, run, secure, and observe large-scale distributed apps, 3rd Edition


What is the step-by-step process to delete a Helm release from a Helm repository?

To delete a Helm release from a Helm repository, you can follow the step-by-step process below:

  1. Connect to the Kubernetes cluster where Helm is installed using the kubectl command-line tool.
  2. List all the releases available in the Helm repository by running the following command: helm list
  3. Identify the release you want to delete from the list. Make a note of the release name.
  4. Delete the Helm release by using the helm delete command followed by the release name. Specify the --purge flag to completely remove the release and all its associated resources. The command would look like this: helm delete --purge
  5. Wait for the release to be deleted. You can check the status of the release deletion by running: helm list
  6. Once the release has been successfully deleted, the release will no longer be listed.


Note that deleting a Helm release will also delete all the Kubernetes resources associated with that release, such as pods, services, deployments, etc.


How to delete a Helm release using a YAML manifest file?

To delete a Helm release using a YAML manifest file, you need to create a YAML file specifying the release’s metadata and other required information.


Here are the steps to delete a Helm release using a YAML manifest file:

  1. Create a YAML file, for example "delete-release.yaml", and populate it with the following content:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  name: <RELEASE_NAME>
  namespace: <NAMESPACE_WHERE_RELEASE_IS_INSTALLED>
spec:
  releaseName: <RELEASE_NAME>
  chart:
    spec:
      chart: <CHART_REFERENCE>
      version: <CHART_VERSION>
      sourceRef:
        kind: <SOURCE_KIND>   # Kind of the chart source: HelmRepository, GitRepository, or Bucket
        name: <SOURCE_NAME>   # Name of the chart source
        namespace: <SOURCE_NAMESPACE>   # Namespace of the chart source
  targetNamespace: <NAMESPACE_WHERE_CHART_WAS_INSTALLED>


Replace <RELEASE_NAME> with the name of the release you want to delete. Replace <NAMESPACE_WHERE_RELEASE_IS_INSTALLED> with the namespace where the release is installed. Replace <CHART_REFERENCE> with the reference to the chart you used when installing the release (e.g., "stable/nginx-ingress"). Replace <CHART_VERSION> with the version of the chart you used when installing the release. Replace <SOURCE_KIND>, <SOURCE_NAME>, and <SOURCE_NAMESPACE> with the details of the chart source, such as HelmRepository, GitRepository, or Bucket. Replace <NAMESPACE_WHERE_CHART_WAS_INSTALLED> with the namespace where the original chart was installed.

  1. Save the file.
  2. Run the following kubectl command to delete the Helm release using the YAML manifest:
1
kubectl apply -f delete-release.yaml


This will apply the manifest file and initiate the deletion of the Helm release.


Note: Make sure you have the necessary permissions to delete the release in the specified namespace.


How to delete a Helm release using the Helm API?

To delete a Helm release using the Helm API, you can follow these steps:

  1. Import the required packages:
1
2
import requests
import json


  1. Set the necessary variables:
1
2
helm_api_url = "http://localhost:8080/helm/api/v1/releases"  # Replace with your Helm API URL
release_name = "my-release"  # Replace with the name of your release


  1. Construct the delete release request:
1
2
3
4
5
6
def construct_delete_release_request(release_name):
    headers = {"Content-Type": "application/json"}
    data = {
        "releaseName": release_name
    }
    return headers, json.dumps(data)


  1. Send the delete release request:
1
2
3
def delete_helm_release(api_url, headers, data):
    response = requests.delete(api_url, headers=headers, data=data)
    return response.status_code, response.text


  1. Call the functions to delete the release:
1
2
3
4
5
headers, data = construct_delete_release_request(release_name)
status_code, response_text = delete_helm_release(helm_api_url, headers, data)

print("Status code:", status_code)
print("Response:", response_text)


Make sure to replace the helm_api_url variable with the correct URL for your Helm API, and the release_name variable with the name of the release you want to delete.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

To force delete a deployment in Kubernetes (k8s) using Helm, you can follow these steps:Identify the name of the deployment you want to delete. You can use the helm list command to find the name. Once you have the deployment name, run the following command to ...
To use MongoDB in Helm deployment, you need to follow these steps:First, ensure that Helm is installed and configured in your Kubernetes cluster. Add the Bitnami Helm chart repository to your Helm configuration using the command: helm repo add bitnami https://...
To access Helm programmatically, you can follow these steps:Import the required Python packages: import subprocess import yaml Define the Helm command structure: helm_command = [ &#39;helm&#39;, # The Helm executable command &#39;install&#39;, # The Helm actio...