如何解决Helm错误:INSTALLATION FAILED : manifests contain a resource that already exists

29次阅读
没有评论

问题描述

在运行helm命令安装my-mysql-operator时,遇到以下错误:

Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: ClusterRole "mysql-operator" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-namespace" must equal "mysql-operator": current value is "mysql"

用户想知道如何删除这个已经存在的资源。

解决方案

请注意以下操作注意版本差异及修改前做好备份。

步骤1

首先,你可以使用以下命令查看helm已安装的所有内容:

helm list --all-namespaces

这将返回类似以下的结果:

NAME                    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
my-mysql-operator       mysql           1               2022-05-26 12:18:28.652497947 -0500 CDT deployed        mysql-operator-2.0.4    8.0.29-2.0.4

步骤2

问题出在资源my-mysql-operator当前安装在mysql命名空间中。为了删除它并重新创建,你可以运行以下命令:

helm uninstall -n mysql my-mysql-operator

然后,你应该能够重新运行之前的安装命令:

helm install my-mysql-operator mysql-operator/mysql-operator --namespace mysql-operator --create-namespace

这样就可以解决问题了。

以上是解决Helm错误的方法,希望对你有帮助!

正文完