<p>Welcome to the wonderful world of container orchestrators. It is considered bad practice to install many apps into a single container. The new way of working is not to install an application server that runs many WAR files. The new way of deploying is to have each app be a self-contained container where your build tool (eg maven) packaged the servlet container and your app together into a single file. Then each container can be deployed to Kubernetes and independently scaled up and restarted. They can also have memory leaks and crash without effecting each other. </p>

<p>One good example of that is <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html" rel="nofollow noreferrer">springboot</a> where in your pom.xml you can tell it to build an executable JAR. This will be large as it will include Tomcat into it. When you run the executable file it will launch java and Tomcat and bind to a port and run your app. You don't have to use springboot you can simply add the Tomcat or Jetty plugin to your maven project and have the container just launch "mvn jetty:run" or "mvn tomcat7:run". </p>

<p>I recommend you try minishift which is like minikube but the openshift distro of kubernetes that has more devops features. If you want to deploy Java Servlet apps you just use its built in catalog, select "Open JDK" supply it with your git repo, and it will checkout your code, build the app with maven, create a container image, and deploy the it, with a route and URL you can access it. Yet you can create things from scratch the catalog is just creating all the necessary YAML. Here is the <a href="https://github.com/jboss-openshift/openshift-quickstarts/tree/master/todolist/todolist-jdbc" rel="nofollow noreferrer">sample code</a> that you would use as your maven project that can be built and run by the "Open JDK" catalog. The  pom.xml shows that when the code is built with <code>mvn -P openshift package</code> it puts the war file into a deployments folder and jboss will run it when the container is started. If you don't like jboss then you can add a <code>.s2i/bin/run</code> script that starts your compiled application another way (e.g. "mvn jetty:run" or "mvn tomcat 7:run")</p>

<p>Helm is a package manager for Kubernetes it works with openshift extensions also. Helm tracks what your have installed and lets you rollback. The official chart repos have ready made charts to install databases and redis etc. I made a <a href="https://github.com/ocd-scm/ocd-deployer" rel="nofollow noreferrer">generic chart</a> that runs any container on openshift kubernetes and we use it to install all our apps whether mode.js or php or whatever. It uses the same YAML as the built in templates use. </p>

<p>When you want to install many charts then you can use <a href="https://github.com/roboll/helmfile" rel="nofollow noreferrer">Helmfile</a>. Your Helmfile has all the yaml to install all your helm charts. The best feature is that it only modifies what changed. If you modify one setting in a Helmfile that configures many apps it will only update the one app. And let you see the prior versions of the k8s yaml of the apps store in k8s and lets you easily rollback to the last working state.</p>

<p>I am making open source the stuff we run a business with as “<a href="https://github.com/ocd-scm/ocd-meta/blob/master/README.md" rel="nofollow noreferrer">OCD</a>” where you change the config in git and a webook will run Helmfile to update your Kubernetes env. Here is the <a href="https://github.com/ocd-scm/ocd-meta/wiki/Minishift" rel="nofollow noreferrer">minishift demo how-to</a>. </p>

CC BY-SA 4.0
2019-01-31T18:33:46.070Z
2019-03-24T14:22:29.690Z
2019-03-24T14:22:29.690Z
simbo1905
<p>As I understand you need to run and Application which is loading it Servlet container and using reverse proxy to serve the static content and you also want that your sample.war and other configuration remains there regardless of the container life cycle. </p>

<p>Here is an Example project which exactly what your are looking for.
<a href="https://github.com/savicprvoslav/kubernetes-front-end-backend-example" rel="nofollow noreferrer">Please see this project on Github </a></p>

<p>Please let me know if you stuck somewhere around. I am glad to assist you.</p>

CC BY-SA 4.0
2019-03-06T04:10:07.793Z
2019-03-06T04:10:07.793Z
Prabhat Singh
<p>I would like to do something like this, but all Kubernetes quickstart demos are just for deploying a simple applications and not multiple.</p>

<p>How would I create a yaml file that can deploy multiple applications like this with Minikube?</p>

<ul>
<li>Deploy tomcat to minikube</li>
<li>Deploy sample.war to tomcat (<a href="https://tomcat.apache.org/tomcat-8.0-doc/appdev/sample/" rel="nofollow noreferrer">https://tomcat.apache.org/tomcat-8.0-doc/appdev/sample/</a> )</li>
<li>Bind tomcat service to hostport 8090</li>
<li>Deploy nginx/apache to minikube</li>
<li>Bind nginx/apache to hostport 8080</li>
</ul>

<kubernetes><minikube>
How do I deploy an applications to Kubernetes with Minikube?
ujjain
# How do I deploy an applications to Kubernetes with Minikube?

(Asked by: username_0 on 2018-12-15)

I would like to do something like this, but all Kubernetes quickstart demos are just for deploying a simple applications and not multiple.

How would I create a yaml file that can deploy multiple applications like this with Minikube?

* Deploy tomcat to minikube
* Deploy sample.war to tomcat (<https://tomcat.apache.org/tomcat-8.0-doc/appdev/sample/> )
* Bind tomcat service to hostport 8090
* Deploy nginx/apache to minikube
* Bind nginx/apache to hostport 8080

**Tags:** kubernetes, minikube


---

## 2 answers

### Answer by username_1 on 2019-01-31. Score: 3

Welcome to the wonderful world of container orchestrators. It is considered bad practice to install many apps into a single container. The new way of working is not to install an application server that runs many WAR files. The new way of deploying is to have each app be a self-contained container where your build tool (eg maven) packaged the servlet container and your app together into a single file. Then each container can be deployed to Kubernetes and independently scaled up and restarted. They can also have memory leaks and crash without effecting each other.

One good example of that is [springboot](https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html) where in your pom.xml you can tell it to build an executable JAR. This will be large as it will include Tomcat into it. When you run the executable file it will launch java and Tomcat and bind to a port and run your app. You don't have to use springboot you can simply add the Tomcat or Jetty plugin to your maven project and have the container just launch "mvn jetty:run" or "mvn tomcat7:run".

I recommend you try minishift which is like minikube but the openshift distro of kubernetes that has more devops features. If you want to deploy Java Servlet apps you just use its built in catalog, select "Open JDK" supply it with your git repo, and it will checkout your code, build the app with maven, create a container image, and deploy the it, with a route and URL you can access it. Yet you can create things from scratch the catalog is just creating all the necessary YAML. Here is the [sample code](https://github.com/jboss-openshift/openshift-quickstarts/tree/master/todolist/todolist-jdbc) that you would use as your maven project that can be built and run by the "Open JDK" catalog. The pom.xml shows that when the code is built with `mvn -P openshift package` it puts the war file into a deployments folder and jboss will run it when the container is started. If you don't like jboss then you can add a `.s2i/bin/run` script that starts your compiled application another way (e.g. "mvn jetty:run" or "mvn tomcat 7:run")

Helm is a package manager for Kubernetes it works with openshift extensions also. Helm tracks what your have installed and lets you rollback. The official chart repos have ready made charts to install databases and redis etc. I made a [generic chart](https://github.com/ocd-scm/ocd-deployer) that runs any container on openshift kubernetes and we use it to install all our apps whether mode.js or php or whatever. It uses the same YAML as the built in templates use.

When you want to install many charts then you can use [Helmfile](https://github.com/roboll/helmfile). Your Helmfile has all the yaml to install all your helm charts. The best feature is that it only modifies what changed. If you modify one setting in a Helmfile that configures many apps it will only update the one app. And let you see the prior versions of the k8s yaml of the apps store in k8s and lets you easily rollback to the last working state.

I am making open source the stuff we run a business with as “[OCD](https://github.com/ocd-scm/ocd-meta/blob/master/README.md)” where you change the config in git and a webook will run Helmfile to update your Kubernetes env. Here is the [minishift demo how-to](https://github.com/ocd-scm/ocd-meta/wiki/Minishift).


---

### Answer by username_2 on 2019-03-06. Score: 0

As I understand you need to run and Application which is loading it Servlet container and using reverse proxy to serve the static content and you also want that your sample.war and other configuration remains there regardless of the container life cycle.

Here is an Example project which exactly what your are looking for.
[Please see this project on Github](https://github.com/savicprvoslav/kubernetes-front-end-backend-example)

Please let me know if you stuck somewhere around. I am glad to assist you.


---

