10.6. Managing KafkaTopic resources without impacting Kafka topics


This procedure describes how to convert Kafka topics that are currently managed through the KafkaTopic resource into non-managed topics. This capability can be useful in various scenarios. For instance, you might want to update the metadata.name of a KafkaTopic resource. You can only do that by deleting the original KafkaTopic resource and recreating a new one.

By annotating a KafkaTopic resource with strimzi.io/managed=false, you indicate that the Topic Operator should no longer manage that particular topic. This allows you to retain the Kafka topic while making changes to the resource’s configuration or other administrative tasks.

You can perform this task if you are using unidirectional topic management.

Procedure

  1. Annotate the KafkaTopic resource in OpenShift, setting strimzi.io/managed to false:

    oc annotate kafkatopic my-topic-1 strimzi.io/managed="false"

    Specify the metadata.name of the topic in your KafkaTopic resource, which is my-topic-1 in this example.

  2. Check the status of the KafkaTopic resource to make sure the request was successful:

    oc get kafkatopics my-topic-1 -o yaml

    Example topic with a Ready status

    apiVersion: kafka.strimzi.io/v1beta2
    kind: KafkaTopic
    metadata:
      generation: 124
      name: my-topic-1
      finalizer:
        strimzi.io/topic-operator
      labels:
        strimzi.io/cluster: my-cluster
    spec:
      partitions: 10
      replicas: 2
    
    # ...
    status:
      observedGeneration: 124 
    1
    
      topicName: my-topic-1
      conditions:
      - type: Ready
        status: True
        lastTransitionTime: 20230301T103000Z

    1
    Successful reconciliation of the resource means the topic is no longer managed.

    The value of metadata.generation (the current version of the deployment) must match status.observedGeneration (the latest reconciliation of the resource).

  3. You can now make changes to the KafkaTopic resource without it affecting the Kafka topic it was managing.

    For example, to change the metadata.name, do as follows:

    1. Delete the original KafkTopic resource:

      oc delete kafkatopic <kafka_topic_name>
    2. Recreate the KafkTopic resource with a different metadata.name, but use spec.topicName to refer to the same topic that was managed by the original
  4. If you haven’t deleted the original KafkaTopic resource, and you wish to resume management of the Kafka topic again, set the strimzi.io/managed annotation to true or remove the annotation.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部