I created a kafka cluster with strimzi operator (version 0.28.0) with the following settings:
spec:
kafka:
config:
log.retention.hours: 5
auto.create.topics.enable: false
default.replication.factor: 3
min.insync.replicas: 2
Assuming that no topic will be created automatically, I added two topic definitions:
_schemas
for schema registry__consumer_offsets
for consumer groups
However after launching the cluster, I see two auto created topics as well:
__strimzi_store_topic
which is represented bystrimzi-store-topic---effb8e3e057afce1ecf67c3f5d8e4e3ff177fc55
Kubernetes resource.strimzi-topic-operator-kstreams-topic-store-changelog
which is represented bystrimzi-topic-operator-kstreams-topic-store-changelog---b75e702040b99be8a9263134de3507fc0cc4017b
Kubernetes resource.
The hash appended to resource names shows that they have been created outside (without using kind: KafkaTopic
CRD)
CodePudding user response:
I did an Internet search for auto.create.topics.enable
and the first result which explained what this configuration does is here. It says:
... there is a property named auto.create.topics.enable that allows topics to be automatically created when producers try to write data into it. That means that if a producer tries to write an record to a topic named customers and that topic doesn’t exist yet — it will be automatically created to allow the writing. Instead of returning an error to the client.
The topics you see created by Strimzi are not created as an automatic result of a producer trying to write to them, but because Strimzi needs them for its own internal state management purposes, so it has created them explicitly.
What you should see is if you try to produce to a topic called foo
, it will fail.
If you instead set auto.create.topics.enable: true
and tried the same thing with a producer, it will not fail, and foo
will be automatically created on the fly by Kafka.