【问题标题】:enable username and password on kafka bridge strimzi在kafka桥srimzi上启用用户名和密码
【发布时间】:2021-06-26 14:41:23
【问题描述】:

我正在尝试将用户名和密码添加到我在 strimzi 上的 kafka 网桥..我不知道我是否配置正确,如果我配置正确,为什么我无法使用我的用户名和密码访问 这是我做的步骤:

secret.yaml

apiVersion: v1
kind: Secret
metadata:
  name: bridgeuser
type: Opaque
data:
  my-password: cmdoR0ZETColMTY3Cg==

bridge.yaml

apiVersion: kafka.strimzi.io/v1alpha1
kind: KafkaBridge
metadata:
  name: my-bridge
spec:
  replicas: 1
  bootstrapServers: my-cluster-kafka-bootstrap:9092
  http:
    port: 8080
  authentication:
      type: plain
      username: user
      passwordSecret:
        secretName: bridgeuser
        password: my-password

这是产生消息的卷曲:

curl -X POST  -u user:rghGFDL*%167 https://localhost:8080/topics/topic   -H 'content-type: application/vnd.kafka.json.v2+json'   -d '{"records": [{"key": "key-1","value": "welcome !!"},{"key": "key-2","value": "welcome !!"}]}'

当我这样尝试时,我得到了:

{
    "offsets": [
        {
            "error_code": 500,
            "message": "Unexpected handshake request with client mechanism PLAIN, enabled mechanisms are []"
        },
        {
            "error_code": 500,
            "message": "Unexpected handshake request with client mechanism PLAIN, enabled mechanisms are []"
        }
    ]
}

如果有人可以帮助并提前致谢

【问题讨论】:

    标签: curl kubernetes apache-kafka kafka-consumer-api strimzi


    【解决方案1】:

    HTTP 桥目前不支持在 HTTP 接口上进行任何身份验证。例如,您可以将它与代理或 API 网关结合使用来获得它。您在此处配置的身份验证是 Bridge 和 Kafka 集群之间的身份验证。

    因此,您的curl 请求中的-u user:rghGFDL*%167 将被忽略。而且您与 Kafka 的连接失败,因为您的代理似乎没有配置为 SASL PLAIN 身份验证(实际上,它似乎没有启用任何 SASL 身份验证,正如 Unexpected handshake request with client mechanism PLAIN, enabled mechanisms are [] 消息所暗示的那样)。

    【讨论】:

    • 那么如何在网桥上添加用户名和密码?
    • 还是不可能? @jakub
    • 正如我在答案中所说,HTTP 不支持它。但您可以将其与代理/API 网关结合以实现身份验证。
    猜你喜欢
    • 2019-09-28
    • 1970-01-01
    • 2013-07-28
    • 2016-09-25
    • 1970-01-01
    • 1970-01-01
    • 2017-05-18
    • 1970-01-01
    • 2016-05-18
    相关资源
    最近更新 更多