Kubernetes-等待其他Pod准备就绪 [英] Kubernetes - wait for other pod to be ready

查看:91
本文介绍了Kubernetes-等待其他Pod准备就绪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个应用程序- app1 app2 ,其中 app1 config server,其中包含 app2 的配置强>.我已经在 app1 中定义了/readiness端点,需要等待它返回OK状态才能启动 app2 的Pod.

I have two applications - app1 and app2, where app1 is a config server that holds configs for app2. I have defined /readiness endpoint in app1 and need to wait till it returns OK status to start up pods of app2.

至关重要的是,部署 app2 直到kubernetes app1 中的/readiness 端点接收到Http Status OK,因为它是配置服务器并拥有app2的关键配置.

It's crucial that deployment of app2 wait till kubernetes receives Http Status OK from /readiness endpoint in app1 as it's a configuration server and holds crucial configs for app2.

是否可以进行这种部署依赖?

Is it possible to do this kind of deployment dependency?

推荐答案

是的,可以使用博客文章(用于某些后台重新计时),但更好的Kubernetes本机模式是使用重试和超时,而不是通过这种方式对依赖项进行硬编码.

Yes, it's possible using Init Containers (also, see this blog post for some background re timing) but a better, more Kubernetes-native pattern is to use retries and timeouts rather than hard-coding dependencies in this way.

这篇关于Kubernetes-等待其他Pod准备就绪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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