将 Helm 3 用于使用 kubectl 部署的现有资源 [英] Use Helm 3 for existing resources deployed with kubectl

查看:35
本文介绍了将 Helm 3 用于使用 kubectl 部署的现有资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们曾经使用普通的 kubectl 命令来部署 kubernetes 资源,用于服务、部署、配置映射等.现在我们需要开始使用 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 .

谢谢,阿里

推荐答案

老实说,虽然 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:

  1. 您的掌舵图正在尝试创建命名空间(例如默认)
  2. 您的部署不会随时停止
  3. 您的掌舵图表有持续的交易量声明

这篇关于将 Helm 3 用于使用 kubectl 部署的现有资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆