kafka kraft sasl jaas config setup using docker bitnami and offset explorer

592 Views Asked by At

I am trying to setup a basic kafka running inside docker using bitnami kafka image with a jaas config and after trying all the combinations, I could not move forward.

Here is the docker-compose file

services:
  kafka:
    restart: always
    image: docker.io/bitnami/kafka:3.5.1
    volumes:
      - ./volumes/kafka/data:/bitnami/kafka
    ports:
      - 9092:9092
      - 9093:9093
      - 9094:9094
      - 9095:9095
    container_name: broker1
    environment:
      KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://broker1:9092,EXTERNAL://localhost:9094,SASL_PLAINTEXT://localhost:9095
      KAFKA_CFG_BROKER_ID: 1
      KAFKA_CFG_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
      KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: '1@broker1:9093'
      KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT, SASL_PLAINTEXT:SASL_PLAINTEXT
      KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094, SASL_PLAINTEXT://:9095
      KAFKA_CFG_NODE_ID: 1
      KAFKA_CFG_PROCESS_ROLES: 'broker,controller'
      KAFKA_CFG_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_KRAFT_CLUSTER_ID: X57tL522R6-loSmbUAbinA
      KAFKA_CFG_LISTENER_NAME_SASL_PLAINTEXT_PLAIN_SASL_JAAS_CONFIG: |
        org.apache.kafka.common.security.plain.PlainLoginModule required \
        username="admin" \
        password="admin-secret" \
        user_admin="admin-secret" \
        user_kafkabroker1="kafkabroker1-secret";

If I use port 9094 which is PLAINTEXT, I am able to connect to the kafka

If I use SASL_PLAINTEXT port 9095, I am not able to connect via offset explorer and seeing the below error logs

broker1  | [2023-10-11 07:25:57,615] INFO [SocketServer listenerType=BROKER, nodeId=1] Failed authentication with /172.18.0.1 (channelId=172.18.0.2:9095-172.18.0.1:55502-91) (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)

offset explorer config enter image description here

I followed almost all the available options from here : https://github.com/bitnami/containers/blob/main/bitnami/kafka/README.md

0

There are 0 best solutions below