<p>I have a very simple web app based on HTML, javascript + little bit jquery, angularjs. It is tested locally on eclipse Jee and on Tomcat and working fine. And its image is working fine on docker locally.</p>

<p>I can access on browser using <code>localhost:8080/xxxx</code>, <code>127.0.0.1:8080/xxxx</code>, <code>0.0.0.0:8080</code>. But when I deploy to google Kubernetes, I'm getting "This site can not be reached" if I use the external IP on the browser. I can ping my external IP, but curl is not working. It's not a firewall issue because sample voting app from dockerhub is working fine on my Kubernetes.</p>

<p><strong>my Dockerfile:</strong></p>

<pre><code>FROM tomcat:9.0
ADD GeoWebv3.war /usr/local/tomcat/webapps/GeoWeb.war
expose 8080
</code></pre>

<p><strong>my pod yaml</strong></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:   
   name: front-app-pod  
labels:      
   name: front-app-pod     
   app: demo-geo-app
spec:   
   containers:   
      - name: front-app     
      image: myrepo/mywebapp:v2    
   ports:    
     - containerPort: 80
</code></pre>

<p><strong>my service yaml</strong></p>

<pre><code>apiVersion: v1
kind: Service
metadata:   
   name: front-service  
labels:     
   name: front-service     
   app: demo-geo-app
spec:  
   type: LoadBalancer   
ports:  
  - port: 80   
  targetPort: 80  
selector:     
   name: front-app-pod      
   app: demo-geo-app
</code></pre>

<p>Change your yamls like this</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:   
   name: front-service  
labels:     
   name: front-service     
   app: demo-geo-app
spec:  
   type: LoadBalancer   
   ports:  
   - port: 80   
     targetPort: 8080
   selector:     
     name: front-app-pod      
     app: demo-geo-app
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:   
   name: front-app-pod  
labels:      
   name: front-app-pod     
   app: demo-geo-app
spec:   
   containers:   
      - name: front-app     
        image: myrepo/mywebapp:v2    
        ports:    
          - containerPort: 8080
</code></pre>
<p>You expose the port 8080 in the docker image. Hence in the service you have to say that the <code>targetPort: 8080</code> to redirect the traffic coming to load balancer on port 80 to the container's port 8080</p>
