gpt4 book ai didi

kubernetes - 有关kubernetes的initContainer的一些问题

转载 作者:行者123 更新时间:2023-12-02 11:36:54 24 4
gpt4 key购买 nike

我有两个容器,也许是A和B,A应该在B之前运行,但是A是服务器应用程序,最终类型是“运行”而不是“完整”,所以我想知道这样B永远不会执行吗?那么我该如何处理呢?

最佳答案

如果A和B是同一Pod的一部分,则initContainer是建立排序的传统方法。

Kubernetes Pod lifecycle,我想你的意思是“正在运行,但没有终止”

在您的情况下,pod liveness/readiness probe更合适,因为服务器直到准备就绪才接受请求。

Straight to the Point: Kubernetes Probes读取“Peter Malina

Both readiness and liveness probe run in parallel throughout the life of a container.

  • Use the liveness probe to detect an internal failure and restart the container (e.g. HTTP server down).
  • Use the readiness probe to detect if you can serve traffic (e.g. established DB connection) and wait (not restart) for the container.

A dead container is also not a ready container.
To serve traffic, all containers within a pod must be ready.



您可以添加 pod readiness gate (stable from 1.14)以指定要评估Pod准备状态的其他条件。

另请阅读 Kubernetes Liveness and Readiness Probes: How to Avoid Shooting Yourself in the Foot中的“ Colin Breck

Should Health Checks call other App Health Checks”将该方法与 InitContainer approach进行了比较

关于kubernetes - 有关kubernetes的initContainer的一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58350084/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com