如何在头盔中使用--wait和安装后挂钩? [英] How to use --wait with post-install hook in helm?

查看:245
本文介绍了如何在头盔中使用--wait和安装后挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装后挂钩中使用安装脚本. 当我使用--wait选项运行helm install时,helm会等待所有pod都准备好,但是helm不会启动安装后钩子脚本. 然后,吊舱尚未准备就绪(吊舱正在等待安装脚本完成).

I use an install script in a post-install hook. When I run helm install with --wait option, helm waits that all pods are ready, but helm does not launch post-install hooks script. Then, the pods are not yet ready (pods are waiting for install script to finish).

我尝试使用预安装挂钩,但是安装脚本需要其他服务才能运行...

I tried with pre-install hook instead, but the install script needs other services to be running...

PS:如果我不使用"--wait",它可以正常工作,但是如果pod启动期间出现错误,则gitlab的CI不会失败.

PS: it works fine if I don't use "--wait", but CI from gitlab won't fail if there is an error during pod startups.

在头盔安装-等待期间是否可以运行安装后挂钩?

Is there a way to run the post-install hooks during the helm install --wait period?

推荐答案

我认为您无法使用Helm解决您的问题安装后挂钩,但您可以使用香草Kubernetes 职位挂钩,即运行作业/挂接以及仅依赖Kubernetes的部署.

I don't think you can solve your problem with Helm post-install hook, but you may with vanilla Kubernetes jobs or perhaps hooks, i.e. running job/hook along with your deployment that will depend only on Kubernetes.

要尝试的第一件事是从现有工作中删除helm.sh/hook个注释.

One of the first things to try is to remove helm.sh/hook annotations from your existing job.

  annotations:
    # This is what defines this resource as a hook. Without this line, the
    # job is considered part of the release.
    "helm.sh/hook": post-install
    "helm.sh/hook-weight": "-5"
    "helm.sh/hook-delete-policy": hook-succeeded

Helm然后可以等待它们完成,因为它们将由Kubernetes执行.

Helm can then wait for them to finish as they will be executed by Kubernetes.

这篇关于如何在头盔中使用--wait和安装后挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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