Kubernetes MirrorMaker2 无法加载 Secret
我有一个奇怪的问题,没有人能指出。为了确保这不是 Azure Kubernetes 问题,我还启动了 minikube 在本地进行测试,但遇到了相同的错误。共同点是 MirrorMaker2 的 Strimzi 0.28。
您可以在此处阅读整个线程,以防有帮助。我们陷入了死胡同。整个讨论的链接是 github 下的 strimzi;
我移动它是因为我不想发送垃圾邮件,因为一位名叫 scholzj 的绅士提供了帮助并提供了一些很好的建议。但似乎没有任何作用。
这是我所做的。
创建秘密
用
cat <<EOF | kubectl apply -n kafka-cloud -f -
apiVersion: v1
kind: Secret
metadata:
name: eventhubssecret
namespace: kafka-cloud
type: Opaque
stringData:
eventhubspassword: Endpoint=sb://<name>.servicebus.windows.net/;SharedAccessKeyName=<keyName>;SharedAccessKey=<password>
EOF
已验证并显示名称空间“kafka-cloud”中存在的值。
运行 Mirror Maker 2
cat <<EOF | kubectl apply -n kafka-cloud -f -
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaMirrorMaker2
metadata:
name: mirror-maker-eventhub
spec:
version: 3.1.0
replicas: 1
connectCluster: "eventhub"
clusters:
- alias: "my-kafka-cluster"
bootstrapServers: my-cluster-kafka-bootstrap:9092
- alias: "eventhub"
bootstrapServers: <name>.servicebus.windows.net:9093
config:
config.storage.replication.factor: 1
offset.storage.replication.factor: 1
status.storage.replication.factor: 1
producer.connections.max.idle.ms: 180000
producer.metadata.max.age.ms: 180000
authentication:
type: plain
username: $ConnectionString
passwordSecret:
secretName: eventhubssecret
password: eventhubspassword
tls:
trustedCertificates: []
mirrors:
- sourceCluster: "my-kafka-cluster"
targetCluster: "eventhub"
sourceConnector:
config:
replication.factor: 1
offset-syncs.topic.replication.factor: 1
sync.topic.acls.enabled: "false"
heartbeatConnector:
config:
heartbeats.topic.replication.factor: 1
checkpointConnector:
config:
checkpoints.topic.replication.factor: 1
topicsPattern: ".*"
groupsPattern: ".*"
EOF
它被创建;
- 创建了 kafkamirrormaker2.kafka.strimzi.io/mirror-maker-eventhub
然后在描述中我们在另一台机器上的 azure 和 minikube 中都得到了这个。共同点是 strimzi 0.28 v1beta2。我在 azure 和mirrormaker2 中看到的所有示例都比较旧。但我们不明白为什么秘密没有通过?
Status:
Conditions:
Last Transition Time: 2022-03-17T00:13:53.909810Z
Message: PLAIN authentication selected, but username or password configuration is missing.
Reason: InvalidResourceException
Status: True
Type: NotReady
Observed Generation: 1
Replicas: 0
Events: <none>
以前有人见过这种行为吗?如果是的话,我错过了什么?或者这是 strimzi 和 Mirrormaker2 的错误吗?我只需要测试将数据从 Kafka 移动到事件中心,并认为 MirrorMaker2 是最佳选择。但两天过去了,我开始怀疑了。
谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是使用 cat <
我认为这是因为用户名中的 $ 。 EH 需要将此作为连接的实际用户名。一旦我将上述内容放入
cat < 之间的文件中,它就会从 CLI 运行,而不进行任何更改。
它起作用了。
使用 EH 使用文件时,不要将其放在 <
The issue was using cat <<EOF | kubectl apply -n kafka-cloud -f -
I think it's because of $ in the username. EH needs this as the actual username for the connection. Once I made the above into a file between
cat <<EOF and the last EOF
it ran from the CLI without changing anything.It worked.
When working with EH use a file, don't cat <<EOF it in.