Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple containers in one pod

Tags:

openshift

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?

like image 895
TomForwood Avatar asked May 27 '26 14:05

TomForwood


1 Answers

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

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.

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:

  • https://github.com/openshift-evangelists/wordpress-quickstart/tree/master/templates

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.


UPDATE 1

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

like image 173
Graham Dumpleton Avatar answered May 30 '26 07:05

Graham Dumpleton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!