<p>I created a POD and exposed it as service using following command:</p>

<p>  </p>

<pre><code>kubectl run nginx --image=nginx --restart=Never --port=80 --expose
</code></pre>

<p>When i execute following commands i get two different IP addresses. What are the below IP addressed represents ? Which IP should be used by other services while calling my service in the cluster.</p>

<pre><code>master $ kubectl get ep nginx

NAME    ENDPOINTS      AGE

nginx   10.40.0.1:80   11m

master $ kubectl get svc nginx

NAME    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE

nginx   ClusterIP   10.103.78.253   &lt;none&gt;        80/TCP    12m
</code></pre>

user1660472
<p>The IP in the endpoints of a service is the IP of the backend pods selected by the selector of the service matching with labels on the pods..If there are more than one replica of the pod there will be more than one IP in the endpoints. The IP in ClusterIP is a virtual IP is what should be used for calling a service.The service forward(with load balancing) any request coming via the clusterIP to POD IPs present in the endpoints.</p>

<p>From the docs <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noreferrer">here</a>.</p>
