Upgrade Confluent Platform Using Confluent for Kubernetes

When you upgrade Confluent Platform from one version to another, we recommend that you perform the upgrade process separate from making other changes to your clusters, such as scaling up, changing configuration, or rotating credentials.

Note that certain configurations cannot be updated on deployed clusters. See Upgrades and updates for this list.

Upgrade ZooKeeper-based Confluent Platform deployments in the following order:

  1. Zookeeper
  2. Kafka
  3. Other Confluent components, excluding Control Center, in any order
  4. Control Center

Upgrade KRaft-based Confluent Platform deployments in the following order:

  1. Kafka
  2. Other Confluent components, excluding Control Center, in any order
  3. Control Center

Upgrade Kafka in the ZooKeeper-mode

You have two options to upgrade Kafka:

Automatic upgrade of Kafka

Starting in the 2.8 release, CFK automates the Kafka upgrade process by setting the following properties in Kafka during upgrades:

  • inter.broker.protocol.version
  • log.message.format.version

This upgrade option is enabled by default for Kafka and is supported for:

  • Kafka image from the standard Confluent Platform Docker registry

    The automatic upgrade feature is not supported for custom image registries.

  • ZooKeeper-based Kafka clusters

    The automatic upgrade feature is not supported for KRaft-based clusters.

Note

In the automatic upgrade process, CFK sets inter.broker.protocol.version in a different format from the non-CFK upgrade process.

For example, when auto-upgrading Kafka from Confluent Platform 7.3 to 7.6, CFK sets the inter-broker protocol version in the format CP-7.3, whereas in a non-CFK upgrade, the inter-broker protocol version is set in a different format based on the Kafka version, 3.3.

To upgrade Kafka:

  1. CFK sets the Kafka inter-broker version to 2.6, by default.

    If you want to overwrite the default inter-broker version before running the auto upgrade, for example, to upgrade from Confluent Platform 7.3 to 7.6, take the following steps:

    1. Add the platform.confluent.io/bootstrap-ibp-version to the Kafka cluster:

      kubectl annotate kafka kafka platform.confluent.io/bootstrap-ibp-version="<inter-broker-version>"
      

      Set <inter-broker-version> in the CFK-format. This would correspond to the Confluent Platform version you are upgrading from. So in the example used here where upgrading from Confluent Platform 7.3, set it to cp-7.3.

    2. Verify that the inter-broker field is successfully updated:

      kubectl get kafka kafka -oyaml | grep previousClusterVersion
      
    3. Remove the annotation from the Kafka CR:

      kubectl annotate kafka kafka platform.confluent.io/bootstrap-ibp-version-
      
  2. In the Kafka CR, verify that the CFK init container image tag has been updated during the CFK upgrade process. The image tag should be the current version of CFK, 2.9.4.

    spec:
      image:
        init: confluentinc/confluent-init-container:2.9.4
    
  3. In the Kafka CR, update the component image tag. The tag is the Confluent Platform release you want to upgrade to.

    spec:
      image:
        application: confluentinc/cp-server:<tag>
    

    For example, to upgrade Kafka to 7.7.1:

    spec:
      image:
        application: confluentinc/cp-server:7.7.1
    
  4. Apply the Kafka CR.

    The automatic upgrade process is triggered when the image tag is higher than the current version of Kafka (status.currentClusterVersion).

  5. Check the final cluster versions:

    kubectl get kafka kafka -oyaml | grep previousClusterVersion
    
    kubectl get kafka kafka -oyaml | grep currentClusterVersion
    

    For example, if you upgrade Confluent Platform 7.3 to 7.6, you will have:

    status.previousClusterVersion: 7.3
    status.currentClusterVersion: 7.6
    

Note

The automatic upgrade process always sets inter.broker.protocol.version to the previous Kafka version. In the above example, CFK sets the inter.broker.protocol.version to 3.3 which is the previous Kafka cluster version. On next upgrade of Confluent Platform 7.6 to 7.7, inter.broker.protocol.version will be set to 3.6.

Manual upgrade of Kafka

In CFK 2.7 and older versions, the upgrade process requires you to manually set the Kafka inter.broker.protocol.version and upgrade Kafka in two phases. This process is still supported.

To upgrade Kafka manually:

  1. In the Kafka CR, update the component image tag. The tag is the Confluent Platform release you want to upgrade to.

    spec:
      image:
        application: confluentinc/cp-server:<tag>
    

    For example, to upgrade Kafka to 7.7.1:

    spec:
      image:
        application: confluentinc/cp-server:7.7.1
    
  2. In the same Kafka CR, verify that the CFK init container image tag has been updated during the CFK upgrade process. The image tag should be the current version of CFK, 2.9.4.

    spec:
      image:
        init: confluentinc/confluent-init-container:2.9.4
    
  3. Add the annotation to the Kafka CR to disable the automatic upgrade feature:

    metadata:
      annotations:
        platform.confluent.io/automatic-ibp-upgrade: "disable"
    
  4. Set the following properties in the Kafka CR to the broker protocol version of the currently installed Confluent Platform version. To get the inter-broker protocol version, refer to the table in Kafka upgrade documentation.

    • If you are upgrading from Confluent Platform version 6.2.x or earlier, set log.message.format.version to the version you are upgrading from.
    • If you are upgrading from Confluent Platform version 7.0 or later, you do not need to set log.message.format.version.
    spec:
      configOverrides:
        server:
          - inter.broker.protocol.version=<current Kafka broker protocol version>
          - log.message.format.version=<current Kafka broker protocol version>
    

    The example below is for upgrading from Confluent Platform 7.4.1 to 7.7. inter.broker.protocol.version is set to 3.,4 that corresponds to Confluent Platform 7.4.1.

    spec:
      configOverrides:
        server:
          - inter.broker.protocol.version=3.4
    
  5. Upgrade Kafka:

    kubectl apply -f <Kafka CR> --name <namespace>
    
  6. After the Kafka brokers have been upgraded, set the properties in the Kafka CR to the target Kafka broker protocol version. Using our example of upgrading to 7.7, it should be set to 3.7.

    spec:
      configOverrides:
        server:
          - inter.broker.protocol.version=3.7
    
  7. Upgrade Kafka.

    kubectl apply -f <Kafka CR> --name <namespace>
    

Upgrade Kafka in the KRaft-mode

Upgrade Kafka that is deployed in the KRaft mode to the latest version in the following steps:

  1. In the Kafka CR, update the component image tag. The tag is the Confluent Platform release you want to upgrade to.

    kind: Kafka
    spec:
      image:
        application: confluentinc/cp-server:<tag>
    

    For example, to upgrade Kafka to 7.7.1:

    kind: Kafka
    spec:
      image:
        application: confluentinc/cp-server:7.7.1
    
  2. In the same Kafka CR, verify that the CFK init container image tag has been updated during the CFK upgrade process. The image tag should be the current version of CFK, 2.9.4.

    spec:
      image:
        init: confluentinc/confluent-init-container:2.9.4
    
  3. Upgrade Kafka.

    kubectl apply -f <Kafka CR> --name <namespace>
    
  4. After verifying that the cluster behavior and performance meet your expectations, increment the metadata.version for the controllers and brokers by running the kafka-features tool with the upgrade argument:

    ./bin/kafka-features upgrade --bootstrap-server <server:port> --metadata 3.7
    

    For information about the metadata version, see Upgrade Kafka brokers in the KRaft-mode.

Upgrade non-Kafka Confluent Platform components

Upgrade Confluent Platform components as below:

  1. In the component CR, update the component image tag. The tag is the Confluent Platform release you want to upgrade to.

    spec:
      image:
        application: <component image>:<tag>
    
  2. In the same component CR, verify that the CFK init container image tag has been updated during the CFK upgrade process. The image tag should be the current version of CFK, 2.9.4.

    spec:
      image:
        init: confluentinc/confluent-init-container:2.9.4
    
  3. When upgrading Control Center:

    If you migrated from Operator 1.x to CFK 2.3.0 or lower, and then you are upgrading to CFK 2.4.0 or higher with Confluent Platform version 7.1 or lower, set the following property in the Control Center CR:

    configOverrides:
      server:
        - confluent.controlcenter.internal.topics.partitions=4
    
  4. Upgrade the component.

    kubectl apply -f <component CR> --name <namespace>