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

[bitnami/kafka] health check fails when running in kraft #33325

Closed
justjooste opened this issue May 10, 2023 · 2 comments
Closed

[bitnami/kafka] health check fails when running in kraft #33325

justjooste opened this issue May 10, 2023 · 2 comments
Assignees
Labels
kafka solved tech-issues The user has a technical issue about an application

Comments

@justjooste
Copy link

justjooste commented May 10, 2023

Name and Version

bitnami/kafka:latest

What architecture are you using?

arm64

What steps will reproduce the bug?

Running on M1 Mac with Docker compose
docker-compose.yaml

version: "3.8"

networks:
  kafka-pipeline:
    driver: bridge

services:

  kafka:
    image: 'bitnami/kafka:latest'
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "nc -z localhost 9092 || exit 1"]
      start_period: 10s
      interval: 5s
      timeout: 10s
      retries: 5
    networks:
      - kafka-pipeline
    ports:
      - '9092:9092'
      - '9093:9093'
    environment:
      - KAFKA_ENABLE_KRAFT=yes
      - KAFKA_CFG_NODE_ID=1
      - KAFKA_CFG_PROCESS_ROLES=broker,controller
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_CFG_LISTENERS=PLAINTEXT://kafka:9092,CONTROLLER://kafka:9093
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka:9093
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true
      - BITNAMI_DEBUG=TRUE

  producer:
    build:
      context: ./Producer
      dockerfile: dockerfile
    container_name: python-producer
    depends_on: 
      kafka:
        condition: service_healthy
    ports:
      - 8001:8001
    networks:
      - kafka-pipeline
    environment:
      - KAFKA_TOPIC_NAME=topic
      - KAFKA_SERVER=kafka
      - KAFKA_PORT=9092

What is the expected behavior?

python producer to run when docker-compose health check dependency returns service_healthy

What do you see instead?

dependency failed to start: container kafka is unhealthy

Additional information

Does not appear that the health check runs at all
probably an issue with configuration?

@justjooste justjooste added the tech-issues The user has a technical issue about an application label May 10, 2023
@bitnami-bot bitnami-bot added this to Triage in Support May 10, 2023
@justjooste justjooste changed the title health check fails when running in kraft [bitnami/kafka] health check fails when running in kraft May 10, 2023
@github-actions github-actions bot added the triage Triage is needed label May 10, 2023
@carrodher carrodher moved this from Triage to In progress in Support May 10, 2023
@github-actions github-actions bot added in-progress and removed triage Triage is needed labels May 10, 2023
@bitnami-bot bitnami-bot assigned migruiz4 and unassigned carrodher May 10, 2023
@migruiz4
Copy link
Member

Hi @justjooste,

The bitnami/kafka image does not have the netcat package installed. That is why the healthcheck will fail:

I have no name!@cc9e95cdd14d:/$ nc -z localhost 9092
bash: nc: command not found

In case it helps, maybe the following command helps you perform a healthcheck, although it is more complex than checking the port is open:

kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --create --if-not-exists && kafka-topics
.sh --bootstrap-server kafka:9092 --topic hc --describe

@github-actions github-actions bot moved this from In progress to Pending in Support May 10, 2023
@justjooste
Copy link
Author

I have used something similar to the above command provided by @migruiz4 and the health check is now working as intended. Thanks!

@github-actions github-actions bot moved this from Pending to In progress in Support May 14, 2023
@bitnami-bot bitnami-bot moved this from In progress to Solved in Support May 14, 2023
@github-actions github-actions bot removed this from Solved in Support May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kafka solved tech-issues The user has a technical issue about an application
Projects
None yet
Development

No branches or pull requests

3 participants