Strimzi Apache Kafka 运营商不尊重 auto.create.topics.enable

Strimzi Apache Kafka operator doesn't respect auto.create.topics.enable

我使用 strimzi 运算符(版本 0.28.0)创建了一个 kafka 集群,设置如下:

spec:
  kafka:
    config:
      log.retention.hours: 5
      auto.create.topics.enable: false
      default.replication.factor: 3
      min.insync.replicas: 2

假设不会自动创建主题,我添加了两个主题定义:

  1. _schemas 模式注册表
  2. __consumer_offsets 消费者群体

但是在启动集群后,我还看到了两个自动创建的主题:

  1. __strimzi_store_topicstrimzi-store-topic---effb8e3e057afce1ecf67c3f5d8e4e3ff177fc55 Kubernetes 资源表示。
  2. strimzi-topic-operator-kstreams-topic-store-changelogstrimzi-topic-operator-kstreams-topic-store-changelog---b75e702040b99be8a9263134de3507fc0cc4017b Kubernetes 资源表示。

附加到资源名称的散列表明它们是在外部创建的(未使用 kind: KafkaTopic CRD)

我在 Internet 上搜索 auto.create.topics.enable,第一个解释此配置功能的结果是 here。它说:

... 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.

你看到的由 Strimzi 创建的主题并不是生产者试图写入它们的自动结果,而是因为 Strimzi 需要它们用于其内部状态管理目的,所以它明确地创建了它们。

你应该看到的是,如果你尝试生成一个名为 foo 的主题,它将失败。

如果您改为设置 auto.create.topics.enable: true 并尝试对生产者进行同样的操作,它不会失败,并且 foo 将由 Kafka 即时自动创建。