Helm错误:升级失败:呈现的清单包含一个已经存在的新资源 [英] Helm Error: UPGRADE FAILED: rendered manifests contain a new resource that already exists
问题描述
上一次升级失败时,我会遇到此错误.
I have this error when the previous upgrade failed.
如果不手动删除所有吊舱和服务,我将无法升级.
I cannot upgrade without deleting manually all my pods and services.
Error: UPGRADE FAILED: rendered manifests contain a new resource that already exists.
Unable to continue with update: existing resource conflict: namespace: ns-xy, name: svc-xy, existing_kind: /v1, Kind=Service, new_kind: /v1, Kind=Service
我尝试了 helm upgrade --force
,但没有成功.
I tried with helm upgrade --force
but with no success.
一种解决方案是删除所有更新的服务和部署,但这很长,并且会造成长时间的中断.
One solution is to delete all the services and deployments updated, but that's long and creates a long interruption.
如何强制升级?
推荐答案
OP没有提到当前使用的头盔版本是什么.因此,假设您使用的版本早于3.1.0:
OP doesn't mention what is the version of helm currently being used. So, assuming that you are using a version earlier than 3.1.0:
- 将头盔升级到3.2.4(当前的3.2版本是哪个)
- 标记并注释要升级的资源(按照#7649 ):
KIND=deployment
NAME=my-app-staging
RELEASE=staging
NAMESPACE=default
kubectl annotate $KIND $NAME meta.helm.sh/release-name=$RELEASE
kubectl annotate $KIND $NAME meta.helm.sh/release-namespace=$NAMESPACE
kubectl label $KIND $NAME app.kubernetes.io/managed-by=Helm
这应该告诉Helm,可以接管现有资源并开始对其进行管理.该过程也适用于api升级(例如将"apps/v1beta2"更改为"apps/v1")或将旧元素加入命名空间.
This should tell Helm that it is okay to take over existing resource and begin managing it. That procedure also works for api upgrades (like "apps/v1beta2" changed to "apps/v1") or onboarding old elements in a namespace.
这篇关于Helm错误:升级失败:呈现的清单包含一个已经存在的新资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!