<p>Trying to deploy my first Java web app to Google Kubernetes. It must have 3 containers.</p>
<p>1 - front end web app</p>
<p>2 - back end Java web app- Jersey web service</p>
<p>3 - Postgres server</p>
<p>The whole web app is working on Eclipse Jee (Tomcat) on my laptop with no issue. The web app is very simple SPA with no Maven or Gradle build.
For backend: Dockerfile</p>
<pre><code>FROM tomcat:9.0
ADD backend.war /usr/local/tomcat/webapps/backend.war
EXPOSE 8080
</code></pre>
<p>The image from the above is working fine. But for front end web app, I am really confused. Tried following variants without any success:<br />
a)</p>
<pre><code>FROM  tomcat:9.0
ADD frontend.war /usr/local/tomcat/webapps/frontend.war
</code></pre>
<p>b)</p>
<pre><code>FROM tomcat:9.0
COPY frontend.war /usr/local/tomcat/webapps/frontend.war
EXPOSE 8080
</code></pre>
<p>c)</p>
<pre><code>FROM 8.0-jre8-alpine
COPY frontend.war /usr/local/tomcat/webapps/frontend.war
</code></pre>
<p>When I tried to access my site using the loadbalancer IP which google provided on browser, getting Not reachable message.</p>

<p>Here is my sample web application with backend as mysql database.</p>

<p><strong>Front-end Dockerfile</strong></p>

<pre><code>FROM  tomcat:9.0
ADD art-gallery-management.war /usr/local/tomcat/webapps/art-gallery-management.war
WORKDIR /usr/local/tomcat/
CMD ["catalina.sh" "run"]
EXPOSE 8080/tcp
</code></pre>

<p><strong>Back-end Dockerfile</strong></p>

<pre><code>FROM mysql:latest
WORKDIR /docker-entrypoint-initdb.d
ADD Schema.sql /docker-entrypoint-initdb.d
CMD ["mysqld"]
EXPOSE 3306/tcp
</code></pre>

<p><strong>Starting containers</strong></p>

<pre><code>docker container run -d --name art-gallery-management-db -e MYSQL_ROOT_PASSWORD=vision -p 3306:3306 bukkasamudram/art-gallery-management:db-latest 
docker container run -d --name art-gallery-management-app --link art-gallery-management-db -p 8090:8080 bukkasamudram/art-gallery-management:app-latest
</code></pre>

<p>Make sure to use <strong>link</strong> option to link front-end container with back-end container.</p>
