We currently have a custom implementation of Hazelcast GridForamtation using "InitialMembershipListener" along with TCP/IP Configuration to discover Memebers in a Cluster. Recently we decided to migrate our application to the cloud, where we wanted to use the K8 AutoDiscovery provided by Hazelcast. But when we updated the hazelcast.xml with the following network configurations, we have not been able to discover other members though our application instances start separately and doesnot throw any logs.
<join>
<multicast enabled="false"/>
<kubernetes enabled="true">
<namespace>default</namespace>
<service-name>hazelcast-app</service-name>
</kubernetes>
</join>
Also please find the following deployment.yaml and rbac.yaml below.
apiVersion: apps/v1
kind: Deployment
metadata:
name: hazelcast-app
spec:
replicas: 2
selector:
matchLabels:
app: hazelcast-app
template:
metadata:
labels:
app: hazelcast-app
spec:
containers:
- name: hazelcast-app
ports:
- containerPort: 5701
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: hazelcast-app
spec:
type: LoadBalancer
selector:
app: hazelcast-app
ports:
- name: hazelcast
port: 5701
- name: app
port: 8080
rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: default-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: hazelcast-ap
namespace: default
Do we need to override InitialMembershipListener with other internal implementations of hazelcast like AliasedDiscoveryConfig. Important to note is we are using Java-RX with Jetty Server for the application with the hazelcast 3.1.1 version. We have now migrated the hazelcast to 4.2.8 version to get support for kubernetes.