无法通过Kubernetes在Hazelcast中创建集群



我正在尝试在Kubernetes上使用Hazelcast。因为Docker安装在Windows上,并且在Docker上模拟Kubernetes环境。下面是配置文件hazelcast.xml

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.7.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties>
<property name="hazelcast.discovery.enabled">true</property>
</properties>

<network>
<join>
<multicast enabled="false" />
<tcp-ip enabled="false"/>

<discovery-strategies>
<discovery-strategy enabled="true"
class="com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy">
<!-- 
<properties>

<property name="service-dns">cobrapp.default.endpoints.cluster.local</property>
<property name="service-dns-timeout">10</property>
</properties>
-->
</discovery-strategy>
</discovery-strategies>
</join>
</network>
</hazelcast>

问题是无法在模拟环境中创建集群。根据我的部署文件,它应该创建三个集群。下面是部署配置文件

apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment
labels:
app: test
spec:
replicas: 3
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: test
imagePullPolicy: Never
image: testapp:latest
ports:
- containerPort: 5701
- containerPort: 8085
---
apiVersion: v1
kind: Service
metadata:
name: test-service
spec:
selector:
app: test
type: LoadBalancer
ports:
- name: hazelcast
port: 5701
- name: test
protocol: TCP
port: 8085
targetPort: 8085

执行部署文件时的输出

Members [1] {
Member [10.1.0.124]:5701 this
}

无论预期的输出是什么,根据部署文件,它应该包含三个集群。有人能帮忙吗?

Hazelcast的默认组播发现在Kubernetes上无法开箱即用。你需要一个额外的插件。有两种选择,Kubernetes API和DNS查找。

请查看相关文档以获取更多信息。

相关内容

  • 没有找到相关文章

最新更新