<p>I have the following setup. </p>

<p>My Vert.x verticles are clustered with Hazelcast and deployed on Kubernetes cluster with following network info:</p>

<pre><code>------------------------------------------------
           TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 10.60.0.0
CIDR = ........................: /14
Netmask = .....................: 255.252.0.0
Netmask (hex) = ...............: 0xfffc0000
Wildcard Bits = ...............: 0.3.255.255
------------------------------------------------
Network Address = .............: 10.60.0.0
Broadcast Address = ...........: 10.63.255.255
Usable IP Addresses = .........: 262,142
First Usable IP Address = .....: 10.60.0.1
Last Usable IP Address = ......: 10.63.255.254
</code></pre>

<p>The Hazelcast's <code>cluster.xml</code> has the following section:</p>

<pre><code>&lt;join&gt;
  &lt;multicast enabled="true"&gt;
    &lt;multicast-group&gt;224.2.2.3&lt;/multicast-group&gt;
    &lt;multicast-port&gt;54327&lt;/multicast-port&gt;
  &lt;/multicast&gt;
&lt;/join&gt;
</code></pre>

<p>All seems fine. When I start verticles in pods, I get the output (abbreviated):</p>

<pre><code>&gt;kubectl get pods --namespace develop -o wide

READY   STATUS    RESTARTS   AGE   IP        
1/1     Running   0          52m   10.60.4.18
1/1     Running   0          4m    10.60.6.19
1/1     Running   0          4m    10.60.1.16
1/1     Running   0          4m    10.60.1.18
1/1     Running   0          4m    10.60.6.18  
1/1     Running   0          4m    10.60.1.17
1/1     Running   0          4m    10.60.4.23
1/1     Running   0          8m    10.60.6.17
1/1     Running   0          4m    10.60.4.22
1/1     Running   0          4m    10.60.4.21
1/1     Running   0          4m    10.60.6.20
1/1     Running   0          5d    10.60.4.9 
</code></pre>

<p>The problem is, that the clusters are groupped not by the group name specified, but rather by the 3rd number of the ip address. So, I'm getting a cluster of:</p>

<pre><code>                      masterAddress=[10.60.1.17]:5701
                      Members[
                              [10.60.1.17]:5701
                              [10.60.1.16]:5701
                              [10.60.1.18]:5701]]
</code></pre>

<p>then 5 members for "cluster" <code>10.60.4.*</code>, 4 members for <code>10.60.6.*</code> and so on and they are not merging...</p>

<p>What am I missing?</p>

<p>TIA</p>

injecteer
<p>Hazelcast has a dedicated plugin for the discovery in Kubernetes. Please check: <a href="https://github.com/hazelcast/hazelcast-kubernetes" rel="nofollow noreferrer">hazelcast-kubernetes</a>.</p>

<p>Mutlicast may or may not work, since it depends on the underlying network. In my experience on GKE, it sometimes works, sometimes it doesn't. That is why multicast-based discovery is never recommended for Kubernetes.</p>

<p>Resources:</p>

<ul>
<li><a href="https://github.com/hazelcast/hazelcast-kubernetes/blob/master/README.md" rel="nofollow noreferrer">Hazelcast Kubernetes README</a></li>
<li><a href="https://github.com/hazelcast/hazelcast-code-samples/tree/master/hazelcast-integration/kubernetes" rel="nofollow noreferrer">Hazelcast Kubernetes Code Sample</a></li>
<li><a href="https://github.com/hazelcast/hazelcast-code-samples/tree/master/hazelcast-integration/kubernetes/samples/embedded" rel="nofollow noreferrer">Sample Spring Boot application with Hazelcast Embedded deployed on Kubernetes</a></li>
</ul>
