如何重新启动初始容器
我有一个要求,需要在应用更改后仅重新启动启动容器,并使应用程序容器运行。此过程应在特定时间每天运行。 任何人都能有任何建议如何实现这一目标。
I have a requirement where need to restart only init container after applying changes, And make app container running. This process should be run every day at specific time.
Can any one has any suggestion how to achieve this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是InitContainers的工作方式 - 您不能独立于主要容器重新启动一个。
有人已经建议每天都有一个克罗恩乔布。
我要考虑的建议是,您可以创建一个睡眠一天的壁灯容器,然后运行工作量,然后再次睡觉。
如果您还需要它在之前运行,则主要容器首先运行,请将其复制为InitContainer。如果可以从开始与主容器并行运行,则可以将其本身就足够了。
This isn't how initContainers work - you can't restart one independently of the main containers.
Someone already suggested a daily cronJob.
My suggestion to consider is that you create a sidecar container that sleeps for a day, then runs the workload, then sleeps again.
If you ALSO need this to run before the main container first runs, duplicate it as an initContainer. If it's acceptable to have it run in parallel to the main container starting then the sidecar container could well be enough by itself.
您为什么不为此过程创建每日cronjob?
Why don't you create a daily cronJob with this process?