After installing Kafka with version 3.5 und KRaft enabled, my consumers do not read any messages. The producer happily writes new messages. No error messages are visible, the consumers just wait endlessly for new messages.
I've installed kafka with help fo the bitnami helm skript in kubernetes. This is my config:
global:
imageRegistry: "remote.docker.bin.abc.ch"
controller:
replicaCount: 1
persistence:
size: 1Gi
podSecurityContext:
enabled: false
containerSecurityContext:
enabled: false
resources:
limits:
memory: 2Gi
externalAccess:
enabled: true
service:
type: LoadBalancer
ports:
external: 9094
autoDiscovery:
enabled: true
broker:
podSecurityContext:
enabled: false
containerSecurityContext:
enabled: false
sasl:
client:
users: ["xyzwu-kafka-user-local"]
passwords: ["*"]
rbac:
create: true
extraConfig:
- deleteTopicEnable: true
Please note that I use port 9094 to access klafka from outside of kubernetes.
I created this client.properites file to log into the kafka instance:
security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="xyzwu-kafka-user-local" password="*";
I created a topic:
kafka-topics.sh --bootstrap-server localhost:9094 --command-config local-client.properties --topic myTopic --create --partitions 3
And sent some messages:
kafka-console-producer.sh --bootstrap-server localhost:9094 --producer.config local-client.properties --topic myTopic
>asdf1
>asdf2
>asdf3
When I try to read messages I do not get anything:
kafka-console-consumer.sh --bootstrap-server localhost:9094 --consumer.config local-client.properties --topic myTopic --from-beginning
Processed a total of 0 messages
I also created a client inside kubernetes and connected directly with localhost:9092 to make sure I don't have a kubernetes/networking problem. But again no messages are read.
I also have a full spring-boot application which shows the same symptom. I can create topics, send messages but nothing is ever read. No error messages are generated.
Any ideas?
After much research, I have found that the bitnami helm script is currently broken for setups with less than 3 brokers.
See https://github.com/bitnami/charts/issues/19522
For development installations, one broker is often enough. Two more settings are needed to get the Kafka server working properly.
Add this to your value.yaml
file:
extraConfig: |
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1