You can upgrade your release to a new version in Helm with the helm upgrade [release-name] [chart] command. But occasionally, trying to update your release can result in the “Error – Cannot Re-Use a Name That is Still in Use”.
We will discuss the root reasons for the “helm has no deployed releases” error in this tutorial, as well as a number of potential fixes.
What Causes the “helm has no deployed releases” Error?
Using the helm upgrade [release-name] [chart] command on a prior unsuccessful release now results in the following error as of Helm 2.7.1:
Error: [release-name] has no deployed releases. Upgrade Failed
To apply the required patches, Helm 2 compares the old and new deployment manifests. However, it does not contrast the resource conditions between the manifestations.
It is conceivable that the cluster lacks some resources if a prior deployment failed. Helm will attempt to upgrade the deployment without installing the missing resources prior to Helm 2.7.1. As of version 2.7.1, Helm uses the most recent successful deployment as the baseline for the upgrade in order to avoid issues.
The system displays the message “Error – Cannot Re-Use a Name That is Still in Use” if there are no successful deployments to be discovered.
Getting rid of the error – Cannot Re-Use a Name That is Still in Use
The “helm has no deployed releases” Error – Cannot Re-Use a Name That is Still in Use, can be resolved in a number of ways, most of which concentrate on updating the status of the unsuccessful deployment that gave rise to the problem:
1: Altering the deployment status
You can get around the problem with Helm 2 by changing the release status to deploy:
configmap [release name]. [release version] kubectl -n Kube-system ' —type=merge {"metadata”: {"labels”: {"STATUS":"DEPLOYED"}}}'
Where:
- The name of the release you want to upgrade is [release name].
- The most recent version of your release is [release version].
Since Kubernetes secrets are how Helm 3 records the deployment history. Verify the deployment tactics:
get secrets with kubectl
To alter the deployment status, locate the secret pertaining to the failed deployment, then execute the command:
Secret kubectl patch [name-of-secret-pertaining-to-deployment] ' —type=merge {"metadata”: {"labels”: {"status":"deployed"}}}'
2: Removing Failed Deployments
The problem can be fixed by scrapping the current release and beginning a new one from scratch. Using Helm 2, perform the following:
[Release name] Helm remove —purge
Where:
The name of the release you want to remove it [release name].
Since Helm 3, the uninstall command is necessary to remove a release:
Helm uninstall [name of the release]
1: Before removing a failed release, make sure your deployment is in good shape.
list helm -a
2: Verify the deployment secrets if your release’s status is not deployed:
get secrets with kubectl
3: Describe the final item on the list of secrets to determine its status.
the command kubectl describe secret
Where:
The name of the secret you seek is [secret name].
4: Delete the secret if its status matches that of the failed deployment by using:
delete secret "[private name]" with kubectl
5: Improve your release by adding:
Helm upgrade [name of release]
3: Requiring an Upgrade
The issue can also be fixed by forcing an upgrade using:
Helm upgrade [name of release] —force
Where:
The name of the release you want to upgrade is [release name].
This works similarly to helm delete —purge in the background, removing the previous release before installing the new one. This could result in service interruptions, making it inappropriate for some releases.
Conclusion
You ought to be able to update your release to a new version after finishing this instruction without getting the ” Error – Cannot Re-Use a Name That is Still in Use” message.