<p>We have a Hazelcast 3.12 cluster running inside an AWS EKS kubernetes cluster.</p>
<p><strong>Do you know how to expose a Hazelcast cluster with more than 1 pod that is running inside an AWS EKS kubernetes cluster to outside the kubernetes cluster?</strong></p>
<p>The Hazelcast cluster has 6 pods and is exposed outside of the kubernetes cluster with a kubernetes &quot;Service&quot; of type LoadBalancer (AWS classic load balancer).</p>
<p>When I run a Hazelcast client from outside of the kubernetes cluster, I am able to connect to the Hazelcast cluster using the AWS load balancer. However, when I try to get some value from a Hazelcast map, the client fails with this error:</p>
<blockquote>
<p>java.io.IOException: No available connection to address [172.17.251.81]:5701 at com.hazelcast.client.spi.impl.SmartClientInvocationService.getOrTriggerConnect(SmartClientInvocationService.java:75</p>
</blockquote>
<p>The error mentions the IP address 172.17.251.81. This is an internal kubernetes IP for a Hazelcast pod that I cannot connect to from outside the kubernetes cluster. I don't know why the client is trying to connect to this IP address instead of the Load Balancer public IP address.</p>
<p>On the other hand, when I scale the hazelcast cluster from 6 to 1 pod, I am able to connect and get the map value without any problem.</p>
<p>In case that you want to review the kubernetes LoadBalancer Service configuration:</p>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: hazelcast-elb
  labels:
    app: hazelcast
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: &quot;true&quot;
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
spec:
  ports:
  - name: tcp-hazelcast-elb
    port: 443
    targetPort: 5701
  selector:
    app: hazelcast
  type: LoadBalancer
</code></pre>

<p>If you expose all Pods with one LoadBalancer service, then you need to use Hazelcast <a href="https://docs.hazelcast.org/docs/latest/manual/html-single/#java-client-operation-modes" rel="nofollow noreferrer">Unisocket Client</a>.</p>
<pre><code>hazelcast-client:
  smart-routing: false
</code></pre>
<p>If you want to use the default <a href="https://docs.hazelcast.org/docs/latest/manual/html-single/#java-client-operation-modes" rel="nofollow noreferrer">Smart Client</a> (which means better performance), then you need to expose each Pod with a separate service, because each Pod needs to be accessible from outside the Kubernetes cluster.</p>
<hr />
<p>Read more in the blog post: <a href="https://hazelcast.com/blog/how-to-set-up-your-own-on-premises-hazelcast-on-kubernetes/" rel="nofollow noreferrer">How to Set Up Your Own On-Premises Hazelcast on Kubernetes</a>.</p>
