将Helm 3用于通过kubectl部署的现有资源 [英] Use Helm 3 for existing resources deployed with kubectl
问题描述
我们过去通常使用普通的kubectl命令来部署kubernetes资源,以用于服务,部署,configmap等.现在我们需要开始使用Helm 3并将其集成到我们的管道中,但是当我尝试运行helm upgrade命令时,出现以下错误:错误:呈现的清单包含已存在的资源.无法继续安装:现有资源冲突:名称空间:默认
We used to deploy kubernetes resources using the normal kubectl command for services, deployments, configmap...etc. Now we need to start using Helm 3 and integrate it to our pipelines, but when I try to run the helm upgrade command, it's giving the below error:
Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: namespace: default
因此,这些资源从未使用helm创建,因为通常使用kubcetl apply命令创建了这些资源.
So, these resources were never created with helm as it was created normally with kubcetl apply command.
只需知道如何在管道中使用Helm,而无需重新创建k8s资源.我发现唯一可行的解决方法是删除资源,然后使用Helm重新部署.
Just need to know how to used Helm in the pipeline without re-create the k8s resources. As the only workaround I found to get it working was to delete the resources and re-deploy them using Helm.
下面是我尝试的命令: helm upgrade --atomic --debug --install --force test.
Below is the command I tried:
helm upgrade --atomic --debug --install --force test .
谢谢,艾莉
推荐答案
老实说,虽然FL3SH的答案是您正在寻找的……最好的选择是删除您的k8s资源.对此有一些例外:
Honestly while FL3SH's answer is what you are looking for... the best choice would be to just delete your k8s resources. There are some exceptions to this:
- 您的头盔图表正在尝试创建名称空间(例如默认名称)
- 您的部署不能在任何时间关闭
- 您的头盔图表具有持续的批量声明
这篇关于将Helm 3用于通过kubectl部署的现有资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!