<p>I'm running a kubernetes cluster in which I am deploying a &quot;cloud native hazelcast&quot; following the instructions on the <a href="https://github.com/kubernetes/kubernetes/tree/master/examples/hazelcast" rel="nofollow noreferrer">kubernetes-hazelcast github page</a>. Once I have a number of hazelcast instances running, I try to connect a java client to one of the instances but for some reason the connection fails.</p>
<h3>Some background</h3>
<p>Using a kubernetes external endpoint I can connect to hazelcast from outside the kubernetes cluster. When I do a REST call with <code>curl kubernetes-master:32469/hazelcast/rest/cluster</code>, I get a correct response from hazelcast with it's cluster information. So I know my endpoint works.</p>
<p>The hazelcast-kubernetes deployment uses the <a href="https://github.com/pires/hazelcast-kubernetes-bootstrapper" rel="nofollow noreferrer">hazelcast-kubernetes-bootstrapper</a> which allows some configuration by setting environment variables with the replication controller, but I'm using all defaults. So my group and password are &quot;someGroup&quot; and &quot;someSecret&quot;.</p>
<h3>The java client</h3>
<p>My Java client code is really straightforward:</p>
<pre><code>ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionTimeout(10000);
clientConfig.getNetworkConfig().setConnectionAttemptPeriod(2000);
clientConfig.getNetworkConfig().addAddress(&quot;kubernetes-master:32469&quot;);
clientConfig.getGroupConfig().setName(&quot;someGroup&quot;);
clientConfig.getGroupConfig().setPassword(&quot;someSecret&quot;)
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
</code></pre>
<p>When start my client this is the log output of the hazelcast container</p>
<pre><code>2016-07-05 12:54:38.143  INFO 5 --- [thread-Acceptor] com.hazelcast.nio.tcp.SocketAcceptor     : [172.16.15.4]:5701 [someGroup] [3.5.2] Accepting socket connection from /172.16.29.0:54333
2016-07-05 12:54:38.143  INFO 5 --- [        cached4] c.h.nio.tcp.TcpIpConnectionManager       : [172.16.15.4]:5701 [someGroup] [3.5.2] Established socket connection between /172.16.15.4:5701
2016-07-05 12:54:38.157  INFO 5 --- [.IO.thread-in-1] c.h.nio.tcp.SocketClientMessageReader    : [172.16.15.4]:5701 [someGroup] [3.5.2] Unknown client type: &lt;
</code></pre>
<p>And the console output of the client</p>
<pre><code>jul 05, 2016 2:54:37 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_someGroup][3.6.2] is STARTING
jul 05, 2016 2:54:38 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_someGroup][3.6.2] is STARTED
jul 05, 2016 2:54:48 PM com.hazelcast.client.spi.impl.ClusterListenerSupport
WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 1 of 2147483647.
jul 05, 2016 2:54:58 PM com.hazelcast.client.spi.impl.ClusterListenerSupport
WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 2 of 2147483647.
jul 05, 2016 2:55:08 PM com.hazelcast.client.spi.impl.ClusterListenerSupport
etc...
</code></pre>
<p>The client just keeps trying to connect but no connection is ever established.</p>
<h3>What am I missing?</h3>
<p>So why won't my client connect to the hazelcast instance? Is it some configuration part I'm missing?</p>

<p>Not sure about the official kubernetes support, however Hazelcast has a kubernetes discovery plugin (based on the new discovery spi) that works on both, client and nodes: <a href="https://github.com/noctarius/hazelcast-kubernetes-discovery" rel="nofollow noreferrer">https://github.com/noctarius/hazelcast-kubernetes-discovery</a></p>
