<p>We are deploying a spring-boot application using spring-session-hazelcast + hazelcast-kubernetes on an OpenShift/Kubernetes cluster.</p>
<p>Due to the nature of our platform, we can only use <code>service-dns</code> configuration. We expose a service on port 5701 for multicasting and set <code>service-dns</code> property to the multicast service name.</p>
<p>Below is a snippet for creation of the Hazelcast instance.</p>
<pre><code>@Bean
public HazelcastInstance hazelcastInstance() {
    var config = new Config();
    config.setClusterName(&quot;spring-session-cluster&quot;);

    var join = config.getNetworkConfig().getJoin();
    join.getTcpIpConfig().setEnabled(false);
    join.getMulticastConfig().setEnabled(false);
    join.getKubernetesConfig().setEnabled(true)
                .setProperty(&quot;service-dns&quot;, &quot;&lt;multicast-service-name&gt;&quot;);

    var attribute = new AttributeConfig()
                .setName(Hazelcast4IndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
                .setExtractorClassName(Hazelcast4PrincipalNameExtractor.class.getName());

    config.getMapConfig(Hazelcast4IndexedSessionRepository.DEFAULT_SESSION_MAP_NAME)
                .addAttributeConfig(attribute)
                .addIndexConfig(new IndexConfig(IndexType.HASH, Hazelcast4IndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE));

    var serializer = new SerializerConfig();
    serializer.setImplementation(new HazelcastSessionSerializer())
        .setTypeClass(MapSession.class);
    config.getSerializationConfig().addSerializerConfig(serializer);

    return Hazelcast.newHazelcastInstance(config);
}
</code></pre>
<p>When we run 2 pods for this application, we see the below ERROR log:</p>
<pre><code>com.hazelcast.internal.cluster.impl.operations.SplitBrainMergeValidationOp
Message: [&lt;private-ip&gt;]:5701 [spring-session-cluster] [4.2] Target is this node! -&gt; [&lt;private-ip&gt;]:5701
</code></pre>
<p>Can someone please explain how to fix this error, still using &quot;service-dns&quot; configuration?</p>

<p>You need to enable headless mode for your service in openshift.</p>
<p><a href="https://github.com/hazelcast/hazelcast-kubernetes#dns-lookup" rel="nofollow noreferrer">https://github.com/hazelcast/hazelcast-kubernetes#dns-lookup</a></p>
