Comments
splisson-altair
added a commit
to splisson-altair/helm
that referenced
this issue
Nov 15, 2017
To use the same command when installing and upgrading a release, using helm upgrade with --install works.
splisson-altair
added a commit
to splisson-altair/helm
that referenced
this issue
Nov 15, 2017
To use the same command when installing and upgrading a release, using helm upgrade with --install works.
splisson
added a commit
to splisson/helm
that referenced
this issue
Nov 15, 2017
To use the same command when installing and upgrading a release, using helm upgrade with '--install' works.
Closes helm#3134
This was referenced
Nov 15, 2017
technosophos
pushed a commit
that referenced
this issue
Nov 21, 2017
* docs(helm): Document how to update a release idempotently
To use the same command when installing and upgrading a release, using helm upgrade with '--install' works.
Closes #3134
* Upgrade instead of update
This was referenced
Aug 20, 2018
Cannot install the helm chart but when I use raw file generated by helm, I am able to install via kubectl apply.
Following error is displayed when i use helm install myChart . --debug
Error: cannot re-use a name that is still in use
helm.go:88: [debug] cannot re-use a name that is still in use
helm.sh/helm/v3/pkg/action.(*Install).availableName
helm.sh/helm/v3/pkg/action/install.go:442
helm.sh/helm/v3/pkg/action.(*Install).Run
helm.sh/helm/v3/pkg/action/install.go:185
main.runInstall
helm.sh/helm/v3/cmd/helm/install.go:242
main.newInstallCmd.func2
helm.sh/helm/v3/cmd/helm/install.go:120
github.com/spf13/cobra.(*Command).execute
github.com/spf13/cobra@v1.1.3/command.go:852
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/cobra@v1.1.3/command.go:960
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/cobra@v1.1.3/command.go:897
main.main
helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
runtime/proc.go:225
runtime.goexit
runtime/asm_amd64.s:1371
Installing raw file generated by helm with the following command works great but when I run helm install myChart .
it gives the above error
helm install myChart . --dry-run > myChart.yaml
kubectl apply -f myChart.yaml
asked Dec 23, 2021 at 16:23
Use upgrade instead install:
helm upgrade -i myChart .
The -i
flag install the release if it doesn’t exist.
answered Dec 23, 2021 at 16:57
2
Another option could be:
- List the available helm charts:
helm list
. E.g.:
- Delete the required helm chart
helm delete phoenix-chart
. E.g.:
answered Sep 17, 2022 at 11:32
sfl0r3nz05sfl0r3nz05
3875 silver badges12 bronze badges
works for me — helm uninstall /<chart_name>
answered Dec 3, 2022 at 18:42
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.
Below is the code which i am using.
Since i am using the same gin context to install and uninstall, so i don’t this its possible that install is happening on one cluster and uninstall on other.
func returnActionConfig(ctx *gin.Context) (*SaveFilePath, *action.Configuration) {
response := SaveFilePath{}
InfoLogger.Println("Inside returnActionConfig")
kubeConfigFile, err := ctx.FormFile("kubeconfig")
if err != nil {
ErrorLogger.Println("get form err for kubeconfig file: ", err.Error())
response.Detail = "get form err for kubeconfig file: " + err.Error()
response.Status = http.StatusBadRequest
return &response, nil
}
kubeConfigPath := filepath.Base(kubeConfigFile.Filename)
if err := ctx.SaveUploadedFile(kubeConfigFile, kubeConfigPath); err != nil {
ErrorLogger.Println("upload file err for kubeconfig file: ", err.Error())
response.Detail = "upload file err for kubeconfig file: " + err.Error()
response.Status = http.StatusInternalServerError
return &response, nil
}
releaseNamespace := ctx.Request.FormValue("releasenamespace")
actionConfig := new(action.Configuration)
if err := actionConfig.Init(kube.GetConfig(kubeConfigPath, "", releaseNamespace), releaseNamespace, os.Getenv("HELM_DRIVER"), func(format string, v ...interface{}) {
str := fmt.Sprintf(format, v)
InfoLogger.Println(str)
}); err != nil {
ErrorLogger.Println("Initialization of action configuration failed: ", err.Error())
response.Detail = "Initialization of action configuration failed: " + err.Error()
response.Status = http.StatusInternalServerError
return &response, nil
}
response.Status = http.StatusOK
response.KubeConfigPath = kubeConfigPath
return &response, actionConfig
}
//ChartInstallFromRepo ...
func (services helmInstallService) ChartInstallFromRepo(ctx *gin.Context) {
repoUpdateErr := repoUpdate()
if repoUpdateErr != nil {
ErrorLogger.Println("Repo Update Error: ", repoUpdateErr)
}
response := InstallOrUpgradeResponse{}
var err error
var release *release.Release
var valueExtPath string
saveFileResp, actionConfig := returnActionConfig(ctx)
if saveFileResp.Status != http.StatusOK {
ErrorLogger.Println("ChartInstallFromRepo: ", saveFileResp.Detail)
response.Status = saveFileResp.Status
response.Detail = saveFileResp.Detail
ctx.JSON(http.StatusOK, response)
return
}
valueExtFile, valueExtErr := ctx.FormFile("valueExt")
if valueExtErr != nil {
ErrorLogger.Println("get form err for valuesExt file: ", valueExtErr.Error())
} else {
valueExtPath = filepath.Base(valueExtFile.Filename)
if err := ctx.SaveUploadedFile(valueExtFile, valueExtPath); err != nil {
ErrorLogger.Println("upload file err for valueExt file:", err.Error())
response.Detail = "upload file err for valueExt file:" + err.Error()
response.Status = http.StatusInternalServerError
ctx.JSON(http.StatusOK, response)
return
}
}
InfoLogger.Println("Values Ext File: ", valueExtFile)
client := action.NewInstall(actionConfig)
if client.Version == "" && client.Devel {
client.Version = ">0.0.0-0"
}
client.ReleaseName = ctx.Request.FormValue("releasename")
client.ChartPathOptions.Version = ctx.Request.FormValue("chartversion")
repo := ctx.Request.FormValue("reponame")
chart := ctx.Request.FormValue("chartname")
cp, err := client.ChartPathOptions.LocateChart(fmt.Sprintf("%s/%s", repo, chart), setting)
if err != nil {
ErrorLogger.Println("Locating chart failed: ", err.Error())
response.Detail = "Locating chart failed: " + err.Error()
response.Status = http.StatusBadRequest
ctx.JSON(http.StatusOK, response)
removeFile(valueExtPath)
return
}
p := getter.All(setting)
// valueOpts := &values.Options{}
// vals, err := valueOpts.MergeValues(p)
// if err != nil {
// log.Fatal(err)
// }
// Check chart dependencies to make sure all are present in /charts
chartRequested, err := loader.Load(cp)
if err != nil {
ErrorLogger.Println("Loading chart failed: ", err.Error())
response.Detail = "Loading chart failed: " + err.Error()
response.Status = http.StatusInternalServerError
ctx.JSON(http.StatusOK, response)
removeFile(valueExtPath)
return
}
// validInstallableChart, err := isChartInstallable(chartRequested)
// if !validInstallableChart {
// log.Fatal(err)
// }
if req := chartRequested.Metadata.Dependencies; req != nil {
// If CheckDependencies returns an error, we have unfulfilled dependencies.
// As of Helm 2.4.0, this is treated as a stopping condition:
// https://github.com/helm/helm/issues/2209
if err := action.CheckDependencies(chartRequested, req); err != nil {
if client.DependencyUpdate {
man := &downloader.Manager{
Out: os.Stdout,
ChartPath: cp,
Keyring: client.ChartPathOptions.Keyring,
SkipUpdate: false,
Getters: p,
RepositoryConfig: setting.RepositoryConfig,
RepositoryCache: setting.RepositoryCache,
}
if err := man.Update(); err != nil {
ErrorLogger.Println("updating local chart dir failed: ", err.Error())
response.Detail = "updating local chart dir failed: " + err.Error()
response.Status = http.StatusInternalServerError
ctx.JSON(http.StatusOK, response)
removeFile(valueExtPath)
return
}
} else {
InfoLogger.Println("Dependency Update failed: ", err.Error())
response.Detail = "Dependency Update failed: " + err.Error()
response.Status = http.StatusInternalServerError
ctx.JSON(http.StatusOK, response)
removeFile(valueExtPath)
return
}
}
}
client.Namespace = ctx.Request.FormValue("releasenamespace")
if valueExtErr == nil {
var vals map[string]interface{}
vals, err = chartutil.ReadValuesFile(valueExtPath)
release, err = client.Run(chartRequested, vals)
} else {
release, err = client.Run(chartRequested, nil)
}
if err != nil {
ErrorLogger.Println("Helm installtion failed: ", err.Error())
response.Detail = "Helm installtion failed: " + err.Error()
response.Status = http.StatusInternalServerError
//uninstall chart to free release name
ChartUninstallSvc(ctx)
ctx.JSON(http.StatusOK, response)
removeFile(valueExtPath)
return
}
InfoLogger.Println(release.Manifest)
InfoLogger.Println("Helm installation successful")
response.Detail = "Helm installation successful"
response.Status = http.StatusOK
response.RevisionNumber = release.Version
response.AppVersion = release.Chart.AppVersion()
response.ChartName = release.Chart.Name() + "-" + release.Chart.Metadata.Version
response.Description = release.Info.Description
response.RevisionNumber = release.Version
response.UpdatedTime = release.Info.LastDeployed.String()
response.DeployStatus = release.Info.Status.String()
removeFile(valueExtPath)
ctx.JSON(http.StatusOK, response)
}
func ChartUninstallSvc(ctx *gin.Context) *Response {
response := Response{}
saveFileResp, actionConfig := returnActionConfig(ctx)
if saveFileResp.Status != http.StatusOK {
ErrorLogger.Println("ChartUnInstall : ", saveFileResp.Detail)
response.Status = saveFileResp.Status
response.Detail = saveFileResp.Detail
return &response
}
releaseName := ctx.Request.FormValue("releasename")
chartUninstall := action.NewUninstall(actionConfig)
releaseresp, err := chartUninstall.Run(releaseName)
if err != nil {
ErrorLogger.Println("ChartUninstall Error: ", err.Error())
response.Status = http.StatusInternalServerError
response.Detail = err.Error()
return &response
}
InfoLogger.Println("ChartUninstall successful for release Name: ", releaseName)
InfoLogger.Println("ChartUninstall Info: ", releaseresp.Release.Info)
response.Status = http.StatusOK
response.Detail = "Chart Uninstall successful for release Name: " + releaseName
return &response
}
@snarkipus First of all, please use this kube.tf.example (it will be released soon, but is compatible with the current release).
This problem showed up to me too in the past. Just make sure to use a proper real domain rancher hostname, not a dummy one, ideally you must own the domain, also point it to the lb.
Also, make sure to choose the rancher install channel of latest
.
Hopefully, it works, but if not, please do include your kube.tf without the token and sensitive values (ideally with all comments meaning unused values removed).
10 replies
But before, destroy, terraform upgrade -init
, and apply again with control plane node of at least cx21!
Just FYI, about the upcoming PR #404, it won’t affect your use case, so you are all good. But anyways, it will probably be merged very soon (like in the next 24h).
Thanks @mysticaltech ! That sorted it … now I just need to figure out how to get to the Rancher desktop!
Thank you so much for your help!
For anyone else that stumbles across this:
kubectl get pods -A -o wide
to get the rancher pod install namekubectl logs -n kube-system helm-install-rancher-nhkxd
to pull the logs from the successfully completed install
I had to do the next step in 2 parts:
kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}'
to get the bootstrap password- enter
https://yoursubdomain.somwhere.com/dashboard/?setup=bootstrappasswordfrompreviousstep
to get to the dashboard
If your DNS is on Cloudflare, just activate orange proxy button in your zone editor for that A record, that you point to the LB IP (you can see it with kubectl get svc -A
).
And go to SSL, choose «strict», to allow the custom rancher certificate on origin! And then just visit the link on https://….
Enjoy!
Hmmm … interesting, proxying through Cloudflare and setting strict
gets me an invalid SSL certificate. I’ll keep poking at it.
Update: @mysticaltech I ended up just settling on Full
since (as far as I can tell) using the Rancher generated CA would require using ‘Advanced Certificates’ from Cloudflare ($10/mon). I’m not entirely sure if that’s expected/known. I suppose the other option would be to use Cloudflare’s certs, but this should work for a non-production environment (I’m guessing).
My bad, it’s the «full» that probably allows the custom certificate on origin. Apologies!
Output of helm version
:3.0.3
Output of kubectl version
:Client Version: version.Info{Major:»1″, Minor:»17″, GitVersion:»v1.17.2″, GitCommit:»59603c6e503c87169aea6106f57b9f242f64df89″, GitTreeState:»clean», BuildDate:»2020-01-18T23:30:10Z», GoVersion:»go1.13.5″, Compiler:»gc», Platform:»linux/amd64″}
Server Version: version.Info{Major:»1″, Minor:»17″, GitVersion:»v1.17.2″, GitCommit:»59603c6e503c87169aea6106f57b9f242f64df89″, GitTreeState:»clean», BuildDate:»2020-01-18T23:22:30Z», GoVersion:»go1.13.5″, Compiler:»gc», Platform:»linux/amd64″}
platform rke
helm install rancher rancher-latest/rancher —namespace cattle-system —set hostname=rancher.comune.intranet
error cannot re-use a name that is still in use
All 5 comments
In the namespace cattle-system there is an existing application named rancher
. Helm is protecting you from installing two applications with the same name in the same namespace. If you fun helm ls --namespace cattle-system
you should see an existing application with the name rancher
already there.
You can use a different name, different namespace, or if the application named rancher should not longer be there you can delete it. Unless you meant to upgrade the application rather than install a new one.
helm ls --namespace cattle-system
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
rancher cattle-system 1 2020-02-05 10:10:23.144025441 +0100 CETfailed rancher-2.3.5 v2.3.5
it seems be ok now. I reinstalled the package
Just wanted to comment on what I did. I just ended up deleting the namespace and trying again
- helm ls —all-namespaces
- kubectl delete namespace cattle-system
- kubectl create namespace cattle-system
- helm install rancher rancher-latest/rancher —namespace cattle-system —set hostname=rancher.DOMAIN —set ingress.tls.source=letsEncrypt —set letsEncrypt.email=EMAIL
for Helm 3 we need to add the namespace for deletion:
helm delete -n my-namespace my-release
Was this page helpful?
0 / 5 — 0 ratings
Cannot install the helm chart but when I use raw file generated by helm, I am able to install via kubectl apply.
Following error is displayed when i use helm install myChart . --debug
Error: cannot re-use a name that is still in use
helm.go:88: [debug] cannot re-use a name that is still in use
helm.sh/helm/v3/pkg/action.(*Install).availableName
helm.sh/helm/v3/pkg/action/install.go:442
helm.sh/helm/v3/pkg/action.(*Install).Run
helm.sh/helm/v3/pkg/action/install.go:185
main.runInstall
helm.sh/helm/v3/cmd/helm/install.go:242
main.newInstallCmd.func2
helm.sh/helm/v3/cmd/helm/install.go:120
github.com/spf13/cobra.(*Command).execute
github.com/spf13/[email protected]/command.go:852
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/[email protected]/command.go:960
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/[email protected]/command.go:897
main.main
helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
runtime/proc.go:225
runtime.goexit
runtime/asm_amd64.s:1371
Installing raw file generated by helm with the following command works great but when I run helm install myChart .
it gives the above error
helm install myChart . --dry-run > myChart.yaml
kubectl apply -f myChart.yaml