<p>I have sample apps running on my cluster. I have a webapp pod which has three containers. Each running as a separate springboot webservice. employee, test1 and test2. The service exposing this is shown below</p>

<p><code>apiVersion: v1
kind: Service
metadata:
 labels:
   name: webapp
 name: webappservice
spec:
 ports:
  - port: 8080
    nodePort: 30062
 type: NodePort
 selector:
   name: webapp</code></p>

<p>The pod spec is below - UPDATED to have whole context</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: webapp
  labels:
    name: webapp
spec:
  containers:
    -
      resources:
        limits:
          cpu: 0.5
      image: kube/employee
      imagePullPolicy: IfNotPresent
      name: wsemp
      ports:
        - containerPort: 8080
          name: wsemp
    -
      resources:
        limits:
          cpu: 0.5
      image: kube/test1
      imagePullPolicy: IfNotPresent
      name: wstest1
      ports:
        - containerPort: 8081
          name: wstest1
  imagePullSecrets:
    - name: myregistrykey
</code></pre>

<p>My assumption was that the webservice runs on 30062 on the node and depending on the mapping, I'll be able to access the webservice. eg <a href="http://11.168.24.221:30062/employee" rel="nofollow noreferrer">http://11.168.24.221:30062/employee</a> and <a href="http://11.168.24.221:30062/test1/" rel="nofollow noreferrer">http://11.168.24.221:30062/test1/</a></p>

<p>Separate logs from employee container and test1 container below.</p>

<pre><code>s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/employee],methods=[GET]}" onto public java.util.List&lt;employee.model.Employee&gt; employee.controller.EmployeeController.getAll()
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/test1/],methods=[GET]}" onto public java.util.List&lt;model.Test1&gt; test1.controller.Test1Controller.getAll()
</code></pre>

<p>Issue is <a href="http://11.168.24.221:30062/employee" rel="nofollow noreferrer">http://11.168.24.221:30062/employee</a> hits the webservice properly. but when I hit  <a href="http://11.168.24.221:30062/test1/" rel="nofollow noreferrer">http://11.168.24.221:30062/test1/</a> , it says the test1/mapping is not available when above in the logs, the mapping is clearly  avaialble. Error message is Whitelabel Error Page/.This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>

<p>Anything I am doing wrong?</p>

<p>Your service yaml shows clearly that you are only exposing port 8080 as NodePort 30062. It is possible to simply add another <code>-port:8081 nodePort:30063</code> to your existing configuration, but - Since your two services are separate containers anyway you may prefer to create two separate deployments and services in kubernetes. One for the employee and one for your test1 service. That will allow you to develop, deploy and test them separately. And it is generally not recommended to use multiple containers in a POD (with some exceptions) - See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/communicate-containers-same-pod/" rel="nofollow noreferrer">this</a>.</p>

<p>Here are the two yamls for the services. Note that I changed the names, labels, and selectors.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
 labels:
   name: employeeservice
 name: employeeservice
spec:
 ports:
  - port: 8080
    nodePort: 30062
 type: NodePort
 selector:
   app: employeeservice
</code></pre>

<hr>

<pre><code>apiVersion: v1
kind: Service
metadata:
 labels:
   name: test1service
 name: test1service
spec:
 ports:
  - port: 8081
    nodePort: 30063
 type: NodePort
 selector:
   app: test1service
</code></pre>

<p>You are not using deployments at all but that is not recommended and you won't benefit from kubernetes self healing abilities, e.g. the pods getting replaced automatically when they become unhealthy.</p>

<p>Creating a deployment is <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">easy</a>. Here are two yamls for deployments that include your POD specs. Note that I changed the names to match the selectors from the services above. I have set the replica count to 1, so only one POD will be maintained per deployment, but you can easily scale it up by setting it to a higher number.</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: employeeservice-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: employeeservice
    spec:
      containers:
        -resources:
          limits:
          cpu: 0.5
        image: kube/employee
        imagePullPolicy: IfNotPresent
        name: wsemp
        ports:
          - containerPort: 8080
            name: wsemp
      imagePullSecrets:
        - name: myregistrykey
</code></pre>

<hr>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: test1service-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: test1service
    spec:
      containers:
      -
        resources:
          limits:
            cpu: 0.5
        image: kube/test1
        imagePullPolicy: IfNotPresent
        name: wstest1
        ports:
          - containerPort: 8081
            name: wstest1
      imagePullSecrets:
        - name: myregistrykey
</code></pre>

<p>Also note that your service is reachable by name through the <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">DNS</a>. So if you use above yamls you should be able to query a service from within the cluster at <code>http://employeeservice/employee</code> instead of using the Nodes ip addresses. For access from outside the cluster you can use the NodePorts as specified and typically would do that through some kind of load balancer that routes to all the nodes. </p>
