掌舵直到在kubernetes上准备好依赖项部署 [英] Helm wait till dependency deployment are ready on kubernetes

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

问题描述

我正在使用Helm Chart将应用程序部署在kubernetes上.但是我在堆栈中使用的服务取决于其他服务,如何确保在依赖关系建立之前不会部署头盔?

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.

还请记住,任何种类的豆荚在Kubernetes中都是可抛弃的. IME如果某项在服务中不起作用,首先要尝试的操作之一是kubectl delete pod,然后让Deployment Controller重新创建它. Kubernetes也可以自己执行此操作,例如,如果它确定需要将Pod定位到其他节点上,则Kubernetes也可以单独执行此操作.那就是:即使您的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.

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

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