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 certainly possible for multiple Pods to mount the same persistent volume but will depend on the underlying storage layer. What are you using? – PhilipGough Oct 07 '17 at 10:17
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:
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.

- 57,726
- 6
- 119
- 134