是否可以对 Kafka 客户端使用 SASL 身份验证但 Zookeeper 不需要它?

Is it possible to use SASL authentication with Kafka clients but not require it for Zookeeper?

我关注了这个:http://docs.confluent.io/current/kafka/sasl.html#sasl-configuration-for-kafka-brokers

为我的 Kafka 集群配置 SASL 身份验证。我想让我所有的客户通过 SASL 向经纪人进行身份验证。我不关心 kafka<->zookeeper。原因是我需要在 Kafka 中创建 ACL。启动 Kafka 集群并收到有关无法向 Zookeeper 进行身份验证的错误时出现问题:

SASL configuration failed: javax.security.auth.login.LoginException: No JAAS configuration section named 'Client' was found in specified JAAS configuration file: '/etc/kafka/kafka_server_jaas.conf'. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it. Opening socket connection to server zk-2.zookeeper-service.default.svc.cluster.local/100.96.16.2:2181 Error occurred while connecting to Zookeeper server[zk-0.zookeeper-service:2181,zk-1.zookeeper-service:2181,zk-2.zookeeper-service:2181]. Authentication failed.

我没有为 SASL 身份验证配置 Zookeeper,如果可以的话我宁愿避免。这可能吗?

可以将 ZooKeeper 排除在 SASL 配置之外。请查看 this document 了解基本的 SASL 设置。希望对你有帮助。

原来我基于我的配置的特定 docker 图像 (confluentinc/cp-kafka:3.2.1) 假定如果 Kafka (https://github.com/confluentinc/cp-docker-images/blob/3.2.x/debian/base/include/cub#L99) Zookeeper 将启用 SASL

它默认将相同的 JAVA 标志传递给 io.confluent.admin.utils.cli.ZookeeperReadyCommand,您可以通过将 ZOOKEEPER_SASL_ENABLED 设置为 false 来选择禁用它。