<p>I have a local Kubernetes install based on Docker Desktop.
I have a Kubernetes Service setup with Cluster IP on top of 3 Pods.
I notice when looking at the Container logs the same Pod is always hit.</p>
<p>Is this the default behaviour of Cluster IP?
If so how will the other Pods ever be used or what is the point of them using Cluster IP?</p>
<p>The other option is to use a LoadBalancer type however I want the Service to only be accessible from within the Cluster.</p>
<p>Is there a way to make the LoadBalancer internal?</p>
<p>If anyone can please advise that would be much appreciated.</p>
<p>UPDATE:</p>
<p>I have tried using an LoadBalancer type and the same Pod is being hit all the time also.</p>
<p>Here is my config:</p>
<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: dropshippingplatform
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: organisationservice-deployment
  namespace: dropshippingplatform
spec:
  selector:
    matchLabels:
      app: organisationservice-pod
  replicas: 3
  template:
    metadata:
      labels:
        app: organisationservice-pod
    spec:
      containers:
      - name: organisationservice-container
        image: organisationservice:v1.0.1
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: organisationservice-service
  namespace: dropshippingplatform
spec:
  selector:
    app: organisationservice-pod
  ports:
    - protocol: TCP
      port: 81
      targetPort: 80
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apigateway-deployment
  namespace: dropshippingplatform
spec:
  selector:
    matchLabels:
      app: apigateway-pod
  template:
    metadata:
      labels:
        app: apigateway-pod
    spec:
      containers:
      - name: apigateway-container
        image: apigateway:v1.0.1
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: apigateway-service
  namespace: dropshippingplatform
spec:
  selector:
    app: apigateway-pod
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: LoadBalancer
</code></pre>
<p>Here is my Ocelot configuration:</p>
<pre><code>{
  &quot;Routes&quot;: [
    {
      &quot;DownstreamPathTemplate&quot;: &quot;/api/organisations&quot;,
      &quot;DownstreamScheme&quot;: &quot;http&quot;,
      &quot;ServiceName&quot;: &quot;organisationservice-service&quot;,
      &quot;ServiceNamespace&quot;: &quot;dropshippingplatform&quot;,
      &quot;UpstreamPathTemplate&quot;: &quot;/APIGateway/Organisations&quot;,
      &quot;UpstreamHttpMethod&quot;: [ &quot;Get&quot; ],
      &quot;Key&quot;: &quot;Login&quot;
    },
    {
      &quot;DownstreamPathTemplate&quot;: &quot;/weatherforecast&quot;,
      &quot;DownstreamScheme&quot;: &quot;http&quot;,
      &quot;ServiceName&quot;: &quot;organisationservice-service&quot;,
      &quot;ServiceNamespace&quot;: &quot;dropshippingplatform&quot;,
      &quot;UpstreamPathTemplate&quot;: &quot;/APIGateway/WeatherForecast&quot;,
      &quot;UpstreamHttpMethod&quot;: [ &quot;Get&quot; ],
      &quot;Key&quot;: &quot;WeatherForecast&quot;
    }
  ],
  &quot;Aggregates&quot;: [
    {
      &quot;RouteKeys&quot;: [
        &quot;Login&quot;,
        &quot;WeatherForecast&quot;
      ],
      &quot;UpstreamPathTemplate&quot;: &quot;/APIGateway/Organisations/Login&quot;
    },
    {
      &quot;RouteKeys&quot;: [
        &quot;Login&quot;,
        &quot;WeatherForecast&quot;
      ],
      &quot;UpstreamPathTemplate&quot;: &quot;/APIGateway/Organisations/TestAggregator&quot;,
      &quot;Aggregator&quot;: &quot;TestAggregator&quot;
    }
  ],
  &quot;GlobalConfiguration&quot;: {
    &quot;ServiceDiscoveryProvider&quot;: {
      &quot;Namespace&quot;: &quot;default&quot;,
      &quot;Type&quot;: &quot;KubernetesServiceDiscoveryProvider&quot;
    }
  }
}
</code></pre>
<p>To isolate the issue I created a Load Balancer in front of the Kubernetes Service in question and called the Service directly from the client. The same Pod is being hit all the time which tells me its to do with Kubernetes and not the Ocelot API Gateway.</p>
<p>Here is the output of kubectl describe svc:</p>
<pre><code>Name:              organisationservice-service
Namespace:         dropshippingplatform
Labels:            &lt;none&gt;
Annotations:       &lt;none&gt;
Selector:          app=organisationservice-pod
Type:              ClusterIP
IP:                X.X.X.119
Port:              &lt;unset&gt;  81/TCP
TargetPort:        80/TCP
Endpoints:         X.X.X.163:80,X.X.X.165:80,X.X.X.166:80
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

Sach K
<p>I solved it. It turned out that Ocelot API Gateway was the issue. I added this to the Ocelot configuration:</p>
<pre><code>&quot;LoadBalancerOptions&quot;: {
        &quot;Type&quot;: &quot;RoundRobin&quot;
      },
</code></pre>
<p>And now its equally distributing the traffic.</p>
