pod 中的多个容器的启动顺序应该如何设置
kamly opened this issue · comments
kamly commented
环境
版本和配置信息
- kubernetes版本:1.7
- docker版本:1.13.1
- 网络插件:calico
- 存储类型:
操作
导致该问题的操作或现象
pod 中的多个容器的启动顺序应该如何设置?网上介绍大部分是使用 initContainers ,但不满足实际需求。
例如 想用一个 pod 中启动 nginx + php ,php 需要先启动,nginx 再启动
有同学也提问类似的问题 #197 ,但还是满足不了实际需求
日志
日志或报错信息
Jimmy Song commented
你的一个 pod 中有几个容器?作为两个容器启动吗?
Deshi Xiao commented
nginx + php放在一个容器内部,使用Dockerfile中使用tini来启动 nginx 和php
init 当pid 1进程防止僵尸进程。参考如下文章
http://yunke.science/2018/04/09/Tini-command/
熊新新 commented
You can consider using statefulset.
Aber commented
谷歌搜这个问题,前几名文章之一是你这篇。贴一下我研究了一个多小时才搞明白的容器启动顺序的博文,以餮后来人。https://aber.sh/articles/Control-the-startup-sequence-of-containers-in-Pod/
Jimmy Song commented
@abersheeran 感谢分享。