<p>I have gone through couple of articles related how clusterIP abd nodeport service works(like <a href="https://www.ovh.com/blog/getting-external-traffic-into-kubernetes-clusterip-nodeport-loadbalancer-and-ingress/" rel="nofollow noreferrer">this blog</a>)</p>

<p>Say I have 3 different micro-service based web application each running on three separate node. Each runs the replica set of two.</p>

<p>My understanding is that there will be separate clusterIP service for application replicaset instead of one single
clusterIP service for all application type. Is that correct ? Now if one pode need to connect to another pod, it will call that corresponding
clusterIP service to connect to right pod ?</p>

<p>Yes, that's right.<br>
In fact, you need to <em>forget</em> about the notion of pod. </p>

<p>As you said, you created 3 web based micro-<strong>service</strong>. So the correct terminology (and need) here, is to contact <strong>(micro-)service A</strong> from <strong>(micro-)service B</strong>. In order to do that, you need to create a <code>kind: Service</code> for each of your <code>ReplicaSet</code>.  </p>

<p>For example :</p>

<pre><code>---
# This is one micro-service based on Nginx
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      name: nginx
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:alpine
          ports:
            - containerPort: 80
---
# This is the ClusterIp service corresponding
apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  selector:
    app: nginx
  ports:
  - port: 8080
    targetPort: 80
</code></pre>

<p>In the example above, we have two replicates of a <em>micro-service</em> based on Nginx. We also have a ClusterIP <code>kind: Service</code> that target our nginx app.</p>

<p>Now, if we want to contact nginx from another pod, all we need to do is use the service name and the port configured from <strong>inside the cluster</strong>. In our case, it'll be <code>nginx:8080</code>.</p>

<p>To try that, you need to create a pod that will serve us as the entry point in the cluster :  </p>

<pre><code>---
apiVersion: v1
kind: Pod
metadata:
  name: gateway
spec:
  containers:
  - image: centos:7
    name: gateway
    command: ["bash", "-c", "sleep infinity"]
</code></pre>

<p>Now, if you want to contact your nginx app from the cluster, you'll have to execute this command :  </p>

<pre><code>kubectl exec -ti gateway curl nginx:8080
</code></pre>
