10.9. Switching between Topic Operator modes


You can switch between topic management modes when upgrading or downgrading Streams for Apache Kafka, or when using the same version of Streams for Apache Kafka, as long as the mode is supported for that version.

Switching from bidirectional to unidirectional topic management mode

  1. Enable the UnidirectionalTopicOperator feature gate.

    The Cluster Operator deploys the Entity Operator with the Topic Operator in unidirectional topic management mode.

  2. The internal topics that support the Topic Operator running in bidirectional topic management mode are no longer required, so you can delete the KafkaTopic resources to manage them:

    oc delete $(oc get kt -n <namespace_name> -o name | grep strimzi-store-topic) \
      && oc delete $(oc get kt -n <namespace_name> -o name | grep strimzi-topic-operator)

    This command deletes the internal topics, which have names starting strimzi-store-topic and strimzi-topic-operator.

  3. The internal topics for storing consumer offsets and transaction states must be retained in Kafka. So, you must first discontinue their management by the Topic Operator before deleting the KafkaTopic resources.

    1. Discontinue management of the topics:

      oc annotate $(oc get kt -n <namespace_name> -o name | grep consumer-offsets) strimzi.io/managed="false" \
        && oc annotate $(oc get kt -n <namespace_name> -o name | grep transaction-state) strimzi.io/managed="false"

      By annotating the KafkaTopic resources with strimzi.io/managed="false", you indicate that the Topic Operator should no longer manage those topics. In this case, we are adding the annotation to resources for managing the internal topics with names starting consumer-offsets and transaction-state.

    2. When their management is discontinued, delete the KafkaTopic resources (without deleting the topics inside Kafka):

      oc delete $(oc get kt -n <namespace_name> -o name | grep consumer-offsets) \
        && oc delete $(oc get kt -n <namespace_name> -o name | grep transaction-state)

Switching from unidirectional to bidirectional topic management mode

  1. Disable the UnidirectionalTopicOperator feature gate.

    The Cluster Operator deploys the Entity Operator with the Topic Operator in bidirectional topic management mode.

    The internal topics required by the Topic Operator running in bidirectional topic management mode are created.

  2. Check whether finalizers are being used to control topic deletion. If KafkaTopic resources are using finalizers, ensure that you do one of the following after making the switch:

    • Remove all finalizers from topics.
    • Disable the finalizers by setting the STRIMZI_USE_FINALIZERS environment variable to false in the Topic Operator env configuration.

      Use the same configuration for a Topic Operator running in a Streams for Apache Kafka-managed cluster or as a standalone deployment.

      Disabling topic finalizers in a Streams for Apache Kafka-managed cluster

      apiVersion: kafka.strimzi.io/v1beta2
      kind: Kafka
      metadata:
        name: my-cluster
      spec:
        # ...
        entityOperator:
          topicOperator: {}
          userOperator: {}
          template:
            topicOperatorContainer:
              env:
                - name: STRIMZI_USE_FINALIZERS
                  value: "false"
      # ...

      Disabling topic finalizers in a standalone deployment

      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: strimzi-topic-operator
      spec:
        template:
          spec:
            containers:
              - name: STRIMZI_USE_FINALIZERS
                value: "false"
      # ...

      The Topic Operator does not use finalizers in bidirectional mode. If they are retained after making the switch from unidirectional mode, you won’t be able to delete KafkaTopic and related resources.

After switching between between Topic Operator modes, try creating a topic to make sure the operator is running correctly. For more information, see 第 10.4 节 “Configuring Kafka topics”.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部