<p>I have successfully deployed a microservice[spring app] on google kubernetes cloud engine.But the endpoint is not working.</p>

<p>Dockerfile
<a href="https://i.stack.imgur.com/BkdWh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BkdWh.png" alt="enter image description here"></a></p>

<p>deployment.yml</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
 name: user-management-deployment
 labels:
  app: happy-paws  
spec:
 replicas: 3
 selector:
  matchLabels:
   name: user-management-deployment
   app: happy-paws
 template:
  metadata:
   name: user-management-deployment
   labels:
    name: user-management-deployment
    app: happy-paws
  spec:
   containers:
    - name: user-management
      image: docker/user-management
      ports:
       - containerPort: 9106
</code></pre>

<p>Service.yml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: user-management
  labels:
   name: user-management-service
   app: happy-paws
spec:
 type: LoadBalancer
 ports:
  - port: 9106
    targetPort: 9106
 selector:
  name: user-management-pod
  app: happy-paws
</code></pre>

<p>application.properties
<a href="https://i.stack.imgur.com/bOfaG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bOfaG.png" alt="enter image description here"></a>
please help me in understanding the problem.</p>

<p>UPDATE:</p>

<p>After updating the port, the application started working</p>

<p>Services that are up:
user-order-detail LoadBalancer
kubernetes ClusterIP
order-management LoadBalancer
user-management LoadBalancer</p>

<p>user-order-detail hits an endpoint to retrieve all users. I am getting this error :No matches for the virtual host name :user-management**</p>

<pre><code>String url = "user-management/user";
        InstanceInfo instance = eurekaClient.getNextServerFromEureka("user-management", false);
        Object response = restTemplate.getForObject(instance.getHomePageUrl() + url +"/" + userId, Object.class);
</code></pre>

<p>Try to understand what service means in kubernetes terminology. On a high level this can be explained as a way to expose your application which is running inside a container (which is running inside a pod(which is running inside a network)) to the external world.  </p>

<p>Each of these blocks can have individual network of their own. Hence concept of Service was introduced. This way you can expose what port of the container needs to be exposed to the world and how it needs to be exposed(Service type, which in your case is LoadBalancer).  </p>

<p>So if you need to access the application running on port 9106 inside the container you need to expose that port.  </p>

<pre><code>spec:
 type: LoadBalancer
 ports:
  - port: 9106
    targetPort: 9106
</code></pre>
