<p>I used this Deployment.yml to create pods.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: price-calculation-deployment
  labels:
    app: price-calculation
spec:
  replicas: 2
  selector:
    matchLabels:
      app: price-calculation
  template:
    metadata:
      labels:
        app: price-calculation
    spec:
      containers:
        - name: price-calculation
          image: ${somewhere}/price-calculation:latest
          ports:
            - containerPort: 80
              protocol: TCP
        - name: pc-mongodb
          image: mongo:latest
          ports:
            - containerPort: 27017
              protocol: TCP
      imagePullSecrets:
        - name: acr-auth
</code></pre>

<p>And, later on, I used this Service.yml to expose port to external.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: price-calculation-service
spec:
  type: LoadBalancer
  ports:
    - port: 5004
      targetPort: 80
      protocol: TCP
  selector:
    app: price-calculation
</code></pre>

<p>Finally, both are working now. Good.</p>

<p>As I configured the LoadBalancer in the Service.yml, there shall be a LoadBalancer dispatches requests to the 2 replicas/pods.</p>

<blockquote>
  <p>Now, I want to know which pod takes the request and how do I know
  that?</p>
</blockquote>

<p>Thanks!!!</p>

ske
<p>well, the easiest way - make pods write their identity in the response, that way you will know which pod responds. Another way - implement distributed tracing with Zipkin\Jaeger. That will give you deep insights into networking flows.</p>

<p>I believe kubernetes doesnt offer any sort of built-in network tracing.</p>
