Kubernetes MirrorMaker2 无法加载 Secret

发布于 2025-01-15 06:09:42 字数 3197 浏览 3 评论 0 原文

我有一个奇怪的问题,没有人能指出。为了确保这不是 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 是最佳选择。但两天过去了,我开始怀疑了。

谢谢。

I have a weird issue that no one can pinpoint. To make sure it was not an Azure Kubernetes issue, I also spun up minikube to test locally and I am getting the same error. The one thing in common Strimzi 0.28 for MirrorMaker2.

You can read the entire thread here in case it might help. We are stuck on a dead end. The link to the entire discussion is github under strimzi;

I moved it as I didn't want to spam as a gentleman by the name of scholzj helped and gave some great advice. But nothing seems to work.

Here is what I have done.

Create The Secret

Replaced actual data with <name>, <keyName>, <password> for posting purposes.

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

Validated and shows the values exist in the namespace "kafka-cloud".

Run 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

It gets created;

  • kafkamirrormaker2.kafka.strimzi.io/mirror-maker-eventhub created

Then on the describe we get this in both azure and also minikube on a different machine. The common denominator is strimzi 0.28 v1beta2. All the examples I have seen with azure and mirrormaker2 are older. But we can't figure out why the secret is not passed??

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>

Has anyone seen this behavior before, if so what am I missing? Or is this a bug with strimzi and Mirrormaker2? I just need to test moving data from Kafka to Event Hub and thought MirrorMaker2 was the way to go. But after two days now, I am having my doubts.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思碎 2025-01-22 06:09:43

问题是使用 cat <

我认为这是因为用户名中的 $ 。 EH 需要将此作为连接的实际用户名。一旦我将上述内容放入 cat < 之间的文件中,它就会从 CLI 运行,而不进行任何更改。

它起作用了。

kubectl apply -n kafka-cloud -f fileName.yaml

使用 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.

kubectl apply -n kafka-cloud -f fileName.yaml

When working with EH use a file, don't cat <<EOF it in.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文