一个吊舱中有多个容器 [英] Multiple containers in one pod

查看:75
本文介绍了一个吊舱中有多个容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从openshift 2迁移应用程序,其中包括Java(jetty)Web服务器和mongo数据库. Web服务器和mongo都需要访问持久性存储以及访问数据库的服务器. 由于无法(我相信)可以由两个Pod访问,所以我目前的目标是将服务器和dB都作为单独的容器包含在同一个Pod中. 我尝试将mongo容器复制到服务器的deploy config中,但是我只是收到一条错误消息,指出该配置无效,没有原因说明. 这种方法行得通吗?我如何找出为什么不行呢?

I am migrating an application from openshift 2 such consists of a Java(jetty) webserver and a mongo database. Both the webserver and mongo need access to persistent storage, as well as the server accessing the database. As the volume available to me can't (I believe) be accessed by two pods my current goal is to include both the server and dB into the same pod as separate containers. I have tried copying the mongo container into the deploy config for the server but I just get an error saying the config is invalid with no description of why. Is this an approach that could work and how can I find out why it isn't?

推荐答案

如果确实需要,可以这样做,但通常不建议在生产系统中使用.

It is possible to do it if you really needed to, but not normally recommended for production systems.

这样做时,您只能使用一个副本并且不能扩展应用程序,也不能使用滚动部署策略,而必须使用Recreate.

In doing it, you are limited to a single replica and cannot scale your application, also, you can't use Rolling deployment strategy and must use Recreate.

有关一些模板的示例示例,这些模板将前端与数据库一起部署在您可能会适应的同一pod中,请参见以下模板的测试"变体:

For some examples of templates which deploy a database with front end together in same pod which you might adapt, see the 'testing' variants of the templates at:

对于那些模板,应用程序映像的构建是作为单独的手动步骤完成的,它们只是在处理部署,因此,在为自己的目的复制和修改它们之后,您需要将构建配置本身合并到其中.

For those templates the build of the application image was done as separate manual step and they were just handling the deployment, so you will need to incorporate the build configuration into them yourself after you have copied and modified them for your own purposes.

更新1

这些模板现在确实包括构建配置,因为它们一直在调整其工作方式.

Those templates do now include build configurations as have been tweaking the way they work.

这篇关于一个吊舱中有多个容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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