Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login into kafka server with username and password failed. #4372

Open
2 tasks done
nhatthanh020996 opened this issue Feb 6, 2024 · 3 comments
Open
2 tasks done

Login into kafka server with username and password failed. #4372

nhatthanh020996 opened this issue Feb 6, 2024 · 3 comments
Labels
status/triage Issues pending maintainers triage type/feature A new feature

Comments

@nhatthanh020996
Copy link

nhatthanh020996 commented Feb 6, 2024

Issue submitter TODO list

  • I've searched for an already existing issues here
  • I'm running a supported version of the application which is listed here and the feature is not present there

Is your proposal related to a problem?

This is my docker compose file that helps me to create my kafka server.

version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
    restart: unless-stopped

  kafka:
    image: wurstmeister/kafka
    depends_on:
    - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENERS: SASL_PLAINTEXT://:9092
      KAFKA_ADVERTISED_LISTENERS: SASL_PLAINTEXT://localhost:9092
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
      ALLOW_PLAINTEXT_LISTENER: 'yes'
      KAFKA_OPTS: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf"
      KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer
      KAFKA_INTER_BROKER_LISTENER_NAME: SASL_PLAINTEXT
      KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
      KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
      KAFKA_SECURITY_PROTOCOL: SASL_PLAINTEXT
      KAFKA_SUPER_USERS: User:admin,User:enzo
      KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./kafka_server_jaas.conf:/etc/kafka/kafka_server_jaas.conf
    
    restart: unless-stopped

kafka_server_jaas.conf

 KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret"
user_enzo="cisternino";
};

KafkaClient {
org.apache.kafka.common.security.plain.PlainLoginModule required
user_admin="admin-secret";
};

Client {};

This is my docker for creating kafka-ui

version: '2'
services:
  kafka-ui:
    image: provectuslabs/kafka-ui
    container_name: kafka-ui
    ports:
    - "8080:8080"
    environment:
      KAFKA_CLUSTERS_0_NAME: 'local'
      KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: 'localhost:9092'
      KAFKA_CLUSTERS_0_ZOOKEEPER: 'zookeeper:2181'
      KAFKA_CLUSTERS_0_PROPERTIES_SECURITY_PROTOCOL: SASL_PLAINTEXT
      KAFKA_CLUSTERS_0_PROPERTIES_SASL_MECHANISM: PLAIN
      KAFKA_CLUSTERS_0_PROPERTIES_SASL_JAAS_CONFIG: 'org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-secret";'

I get the following error after runing kafka-ui docker:

AdminClient clientId=kafka-ui-admin-1707208145-7] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.

Describe the feature you're interested in

I want to log into the kafka server successfully.

Describe alternatives you've considered

I did read this issue, however the issue still remain.
#573

Version you're running

the latest version

Additional context

No response

@nhatthanh020996 nhatthanh020996 added status/triage Issues pending maintainers triage type/feature A new feature labels Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

Hello there nhatthanh020996! 👋

Thank you and congratulations 🎉 for opening your very first issue in this project! 💖

In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀

@rgdev
Copy link

rgdev commented Feb 27, 2024

KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: 'localhost:9092'

If you point to localhost within a container it will send requests to the container's loopback interface and since Kafka lives in another container this cannot work.

Instead put kafka ui and kafka on the same docker network and resolve using the container name like so :

KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: 'kafka:9092'

@NZenitram
Copy link

I have this configured appropriately:

    environment:
      DYNAMIC_CONFIG_ENABLED: 'true'
      KAFKA_CLUSTERS_0_NAME: relay-cluster
      KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092

And I am still getting this error in the logs:

kafka-ui | 2024-08-24 15:50:31,526 WARN [kafka-admin-client-thread | kafka-ui-admin-1724514626-3] o.a.k.c.NetworkClient: [AdminClient clientId=kafka-ui-admin-1724514626-3] Connection to node 1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage Issues pending maintainers triage type/feature A new feature
Projects
None yet
Development

No branches or pull requests

3 participants