Cannot install kubernetes helm chart Error: cannot re-use a name that is still in use
Asked Answered
D

6

33

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
Drumm answered 23/12, 2021 at 16:23 Comment(0)
D
64

Use upgrade instead install:

helm upgrade -i myChart .

The -i flag install the release if it doesn't exist.

Dyson answered 23/12, 2021 at 16:57 Comment(2)
But i tried to deploy for the first time.. No worries.. It solved the issueDrumm
@Drumm what was your solution?Zach
R
17

Removing a sh.helm.release.v1.<chart>.v1 kubesecret and trying again was what I had to do.

I searched for the impacting secret with

kubectl get secrets -n <chart-namespace> or

kubectl get secrets --all-namespaces

Runnymede answered 24/2, 2023 at 17:30 Comment(1)
Other answers didn't work for me, this one did.Ginzburg
F
14

Another option could be:

  1. List the available helm charts: helm list. E.g.: enter image description here
  2. Delete the required helm chart helm delete phoenix-chart. E.g.: enter image description here
Fronde answered 17/9, 2022 at 11:32 Comment(0)
B
4

works for me - helm uninstall /<chart_name>

Borosilicate answered 3/12, 2022 at 18:42 Comment(0)
L
1

In my case, helm uninstall doesn't happen properly

host1:~ # helm uninstall longhorn -n longhorn-system
Error: 1 error occurred:
        * job failed: BackoffLimitExceeded


host1:~ #

Under helm list its been removed,

host1:~ # helm list -A
NAME                                    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                                           APP VERSION
host1:~ #   

List of pods that are not deleted yet, and see uninstall stuck at error,

host1:~ # kubectl get pods -n longhorn-system
NAME                                                READY   STATUS    RESTARTS   AGE
csi-attacher-785fd6545b-8qjqv                       1/1     Running   0          14h
csi-attacher-785fd6545b-h7wmq                       1/1     Running   0          14h
csi-attacher-785fd6545b-lr625                       1/1     Running   0          14h
csi-provisioner-8658f9bd9c-27mmk                    1/1     Running   0          14h
csi-provisioner-8658f9bd9c-4sgvn                    1/1     Running   0          14h
csi-provisioner-8658f9bd9c-m8xgt                    1/1     Running   0          14h
csi-resizer-68c4c75bf5-4sd4t                        1/1     Running   0          14h
csi-resizer-68c4c75bf5-f4lqc                        1/1     Running   0          14h
csi-resizer-68c4c75bf5-lcl6l                        1/1     Running   0          14h
csi-snapshotter-7c466dd68f-26w6t                    1/1     Running   0          14h
csi-snapshotter-7c466dd68f-gzcht                    1/1     Running   0          14h
csi-snapshotter-7c466dd68f-n6jcv                    1/1     Running   0          14h
engine-image-ei-74783864-jbldp                      1/1     Running   0          14h
instance-manager-b00a9cfc3d9c0134d4764fb2c3664f0b   1/1     Running   0          14h
longhorn-csi-plugin-6zxg5                           3/3     Running   0          14h
longhorn-driver-deployer-8657b87cf9-b77rw           1/1     Running   0          14h
longhorn-manager-pxnwm                              1/1     Running   0          14h
longhorn-ui-74966dd455-98gp7                        1/1     Running   0          14h
longhorn-ui-74966dd455-c6m62                        1/1     Running   0          14h
longhorn-uninstall-9drls                            0/1     Error     0          6m12s
longhorn-uninstall-vnf79                            0/1     Error     0          6m6s
host1:~ #

Solved by deleting the longhorn namespace itself,

host1:~ # kubectl delete ns longhorn-system
namespace "longhorn-system" deleted
host1:~ #

In case if namespace stuck in Terminating state, Update your namespace accordingly

export NAMESPACE="longhorn-system"
kubectl get namespace $NAMESPACE -o json   | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/"   | kubectl replace --raw /api/v1/namespaces/$NAMESPACE/finalize -f -
Leavitt answered 6/9, 2023 at 17:22 Comment(0)
U
0

Helm Command: Upgrade Not Install

helm upgrade -i myChart .
Unexceptionable answered 25/7 at 18:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.