<p>I have a requirement to convert a multipod setup to a single pod with multiple container. I had pod x running x microservice and pod y running y microservice with below rest endpoint.</p>
<ul>
<li><code>http://x:8080/{context path-x}/endpoint</code></li>
<li><code>http://y:8080/{context path-y}/endpoint</code></li>
</ul>
<p>I want to have pod z with x and y microservice with container x exposed on 8080 port and y on 8081 within same pod. I am able to achieve these with multi-container pod.</p>
<p>My problem is now the URL are changed</p>
<ul>
<li><code>http://z:8080/{context path-x}/endpoint</code></li>
<li><code>http://z:8081/{context path-y}/endpoint</code></li>
</ul>
<p>I am looking for way in which I can hit endpoints without the change is URL or minimum hit with below URLs</p>
<ul>
<li><code>http://x:8080/{context path-x}/endpoint</code></li>
<li><code>http://y:8081/{context path-y}/endpoint</code></li>
</ul>
<p>My real project requirement has 5 container on single pods and has 100s of endpoints exposed</p>
<p>How can I achieve this?</p>

NAGESH KAMAT
<p>Here's how I addressed my problem:</p>
<p>Application Deployment File (x and y containers on deployment z)</p>
<pre><code>
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: z
spec:
  replicas: 1
  progressDeadlineSeconds: 600
  selector:
    matchLabels:
      component: z
  template:
    metadata:
      annotations:
        version: v1.0
      labels:
        component: z
        occloud.oracle.com/open-network-policy: allow
      name: z
    spec:
      containers:
        - name: x
          image:x:dev
          ports:
            - containerPort: 8080
        - name: y
          image: y:dev
          ports:
            - containerPort: 8081
---
kind: Service
apiVersion: v1
metadata:
  name: x
  annotations:
    version: v1.0
spec:
  selector:
    component: z
  ports:
     - name: x
       port: 8080
       targetPort: 8080
  type: ClusterIP           
---
kind: Service
apiVersion: v1
metadata:
  name: y
  annotations:
    version: v1.0
spec:
  selector:
    component: z
  ports:
     - name: y
       port: 8080
       targetPort: 8081
  type: ClusterIP
</code></pre>
<p>http://x:8080/{context path-x}/endpoint
http://y:8080/{context path-y}/endpoint</p>
