Helm 等到 kubernetes 上的依赖项部署准备就绪 [英] Helm wait till dependency deployment are ready on kubernetes

查看:31
本文介绍了Helm 等到 kubernetes 上的依赖项部署准备就绪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 helm chart 在 kubernetes 上部署我的应用程序.但是我在堆栈中使用的服务取决于其他服务,我如何确保在依赖项启动之前不会部署 helm?

I'm using helm chart to deploy my application on kubernetes. But services that I'm using in my stack depends on other services how do I make sure helm will not deploy until the dependencies are up?

推荐答案

通常你不会;您只需让 Helm(或 kubectl apply -f)一次性启动所有内容,然后重试启动所有内容.

Typically you don't; you just let Helm (or kubectl apply -f) start everything in one shot and let it retry starting everything.

最常见的模式是,如果外部服务不可用,容器进程会在启动时简单地崩溃;发生这种情况时,Kubernetes Pod 机制将重新启动容器.如果依赖永远不会出现,你将永远陷入 CrashLoopBackOff 状态,但如果它在 5-10 秒内出现,那么一切都会在一两分钟内正常出现.

The most common pattern is for a container process to simply crash at startup if an external service isn't available; the Kubernetes Pod mechanism will restart the container when this happens. If the dependency never comes up you'll be stuck in CrashLoopBackOff state forever, but if it appears in 5-10 seconds then everything will come up normally within a minute or two.

另请记住,任何类型的 Pod 在 Kubernetes 中都可以随意使用.IME 如果某项服务在服务中不起作用,首先要尝试的是 kubectl delete pod 并让部署控制器重新创建它.Kubernetes 也可以自行执行此操作,例如,如果它决定需要将 pod 重新定位到不同的节点.也就是说:即使您的 Pod 首次启动时某些依赖项已启动,也不能保证它会永远保持运行状态.

Also remember that pods of any sort are fairly disposable in Kubernetes. IME if something isn't working in a service one of the first things to try is kubectl delete pod and letting a Deployment controller recreate it. Kubernetes can do this on its own too, for example if it decides it needs to relocate a pod on to a different node. That is: even if some dependency is up when your pod first start sup, there's no guarantee it will stay up forever.

这篇关于Helm 等到 kubernetes 上的依赖项部署准备就绪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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