无法安装 kubernetes 上挂图管理图表 错误: 无法重新使用仍在使用中的名称
原标题:Cannot install kubernetes helm chart Error: cannot re-use a name that is still in use
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
最佳回答
Use upgrade instead install:
helm upgrade -i myChart .
The -i flag install the release if it doesn t exist.
问题回答
Removing a sh.helm.release.v1..v1 kubesecret and trying again was what I had to do.
I searched for the impacting secret with
kubectl get secrets -n or
kubectl get secrets --all-namespaces
Another option could be:
List the available helm charts: helm list. E.g.:
Delete the required helm chart helm delete phoenix-chart. E.g.:
works for me - helm uninstall /
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 "
" | sed "s/"finalizers": [[^]]+]/"finalizers": []/" | kubectl replace --raw /api/v1/namespaces/$NAMESPACE/finalize -f -
Helm Command: Upgrade Not Install
helm upgrade -i myChart .