在多个 Kafka 代理上配置 SASL_PAINTEXT

问题描述 投票:0回答:1

我正在尝试在 Kubernetes 上设置一个 kafka statefulset,最多可扩展到 3 个 pod,并且希望所有 kafka 代理能够与 SASL_PLAINTEXT 机制连接,但是我得到的结果是只有一个代理能够连接并且它阻塞了其余经纪人。任何人都可以帮助我让他们都能够与 SASL_PLAINTEXT 连接: 这是部署清单:

java.lang.IllegalArgumentException:要求失败:配置结束 广告听众中的点 xx.x.x.xxx:9094 已经注册 经纪人 2

这里是挂载的kafka_jaas.json:

KafkaClient {
    org.apache.kafka.common.security.plain.PlainLoginModule required 
    username="kafka-user" 
    password="kafka-password" 
    user_kafka="kafka-password";
    };
KafkaServer {
    org.apache.kafka.common.security.plain.PlainLoginModule required 
    username="kafka-user" 
    password="kafka-password" 
    user_kafka="kafka-password";
    };

和听众配置:

    - name: KAFKA_LISTENERS
      value: "INSIDE://:9092,LB://:9094,CONTROLLER://:9093"
    - name: KAFKA_ADVERTISED_LISTENERS
      value: "INSIDE://:9092,LB://xx.x.x.xxx:9094,CONTROLLER://:9093"
    - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
      value: "INSIDE:SASL_PLAINTEXT,LB:SASL_PLAINTEXT,CONTROLLER:SASL_PLAINTEXT"

    - name: KAFKA_INTER_BROKER_LISTENER_NAME
      value: "INSIDE"

    - name: KAFKA_CONTROLLER_LISTENER_NAME
      value: "CONTROLLER"

    - name: KAFKA_CONTROLLER_SHUTDOWN_ENABLE
      value: "false"
    - name: KAFKA_SASL_MECHANISM_CONTROLLER_PROTOCOL
      value: "PLAIN" 
    - name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL
      value: "PLAIN" 
    - name: KAFKA_SASL_ENABLED_MECHANISMS
      value: "PLAIN" 

(xx.x.x.xxx替换为kafka服务的负载均衡器的外部IP地址) & Kafka 图像是:wurstmeister/kafka:2.12-2.2.1 动物园管理员图像:动物园管理员:3.5

kubernetes apache-kafka apache-zookeeper jaas sasl
1个回答
0
投票

我通过将监听器指向 replicasets 的 podIP 来解决它

    - name: MY_POD_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP
        - name: KAFKA_LISTENERS
          value: "INSIDE://:9092"
        - name: KAFKA_ADVERTISED_LISTENERS
          value: "INSIDE://$(MY_POD_IP):9092"
© www.soinside.com 2019 - 2024. All rights reserved.