They should able to communicate and update should visible to each other i mean mainly syncing.
DiscoveryStrategyConfig strategyConfig = new DiscoveryStrategyConfig(factory); Blockquote
// strategyConfig.addProperty("service-dns", "my-serice-name.my-namespace.svc.cluster.local"); // strategyConfig.addProperty("service-dns-timeout", "300");
strategyConfig.addProperty("service-name", "my-service-name"); strategyConfig.addProperty("service-label-name", "my-service-label"); strategyConfig.addProperty("service-label-value", true); strategyConfig.addProperty("namespace", "my-namespace");
I have followed the https://github.com/hazelcast/hazelcast-kubernetes.I have used the first approach was able to see the instance(per pod not in one members list) but they were not communicating (if I am doing crud in one hazel instance it's not reflecting in other). I want to use DNS strategy but was not able to create the instance only.
Please check the followings:
For Kubernetes you need to use the HazelcastKubernetesDiscoveryStrategy
class. It can be defined in the XML configuration or in the code (as in your case).
Check that the service for your Hazelcast cluster has the labels you specified. The same when it comes to the service name and namespace.
There are two ways to configure the discovery: DNS Lookup and REST API. Each has special requirements. You mentioned DNS Lookup, but the configuration you've sent actually uses REST API.
Your Hazelcast cluster service must be headless ClusterIP.
spec:
type: ClusterIP
clusterIP: None
You need to grant access for you app to access Kubernetes API. Please check: https://github.com/hazelcast/hazelcast-code-samples/blob/master/hazelcast-integration/kubernetes/rbac.yaml