Helm 按特定顺序安装 [英] Helm install in certain order

查看:41
本文介绍了Helm 按特定顺序安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下资源创建 Helm Chart:

I am trying to create a Helm Chart with the following resources:

  1. 秘密
  2. 配置映射
  3. 服务
  4. 工作
  5. 部署

这些也是按照我希望它们的部署顺序进行的.我在部署中放置了一个钩子,以便它在安装后进行,但是 Helm 没有将其视为资源,我必须手动管理它.

These are also in the order that I would like them to be deployed. I have put a hook in the Deployment so that it is post-install, but then Helm does not see it as a resource and I have to manually manage it.

作业需要 Secret 和 ConfigMap 中的信息,否则我会将其设为预安装挂钩.但是我不能让所有的东西都成为一个钩子,否则在我的版本中什么都不会被管理.

The Job needs the information in the Secret and ConfigMap, otherwise I would make that a pre-install hook. But I can't make everything a hook or nothing will be managed in my release.

有没有人有解决方案或想法来管理 Helm 版本中的所有资源并确保作业在部署开始之前完成?

Does anyone have a solution or idea to be able to manage all of the resources within the Helm release AND make sure the Job finishes before the Deployment begins?

我现在唯一的想法是两个制作两个图表:一个是 1-4,第二个是 5,这取决于第一个.

My only thought right now is two make two Charts: One with 1-4 and the second with 5 which would depend on the first.

推荐答案

Helm 收集给定 Chart 中的所有资源及其依赖项,按资源类型对它们进行分组,然后按以下顺序安装它们(请参阅 这里 - Helm 2.10):

Helm collects all of the resources in a given Chart and it's dependencies, groups them by resource type, and then installs them in the following order (see here - Helm 2.10):

  1. 命名空间
  2. 资源配额
  3. 限制范围
  4. PodSecurityPolicy
  5. 秘密
  6. 配置映射
  7. 存储类
  8. 持久卷
  9. PersistentVolumeClaim
  10. 服务帐户
  11. 自定义资源定义
  12. 集群角色
  13. 集群角色绑定
  14. 角色
  15. 角色绑定
  16. 服务
  17. 守护进程集
  18. 豆荚
  19. 复制控制器
  20. 副本集
  21. 部署
  22. StatefulSet
  23. 工作
  24. 定时任务
  25. 入口
  26. API 服务

在卸载版本期间,顺序颠倒(参见 此处).

During uninstallation of a release, the order is reversed (see here).

按照这个逻辑,在你创建 Job 资源的情况下,Secret 和 ConfigMap 都已经被应用,但是 Helm 不会在应用 Deployment 之前等待 Job 完成.如果您将 Chart 分成两部分 (1-4, 5) 并按顺序安装它们,您仍然会遇到可能在作业完成之前应用部署的问题.我的建议是将您的图表分成两部分(1-3、4-5),其中作业有一个预安装挂钩,这将确保它在应用部署之前完成.

Following this logic, in your case when your Job resource is created, both the Secret and the ConfigMap will already be applied, but Helm won't wait for the Job to complete before applying the Deployment. If you split your Chart to two parts (1-4, 5) and install them sequentially you would still have the problem of the Deployment being possibly applied before the Job is completed. What I would suggest is splitting your Chart to two parts (1-3, 4-5), in which the the Job has a pre-install hook, which would make sure it completes before your Deployment is applied.

这篇关于Helm 按特定顺序安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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