Enterprise: Upgrade images used by Catalog Applications
To reduce the risk caused by vulnerabilities present in older Kafka and Zookeeper images, you should upgrade image references in theZookeeperCluster and KafkaCluster custom resources on attached clusters.
Please note that you must perform this step after completing your upgrade of DKP. You should perform this step after upgrading the zookeeper-operator and kafka-operator applications themselves.
Note that these images can be upgraded individually, on a cluster-by-cluster basis.
Upgrading a Zookeeper image reference in a ZookeeperCluster resource
The DKP catalog in 2.7 includes an updated Zookeeper 3.7.2 image, which does not contain CVEs present in earlier versions. This image is hosted at ghcr.io/mesosphere/zookeeper:0.2.15-d2iq. To update an existing Zookeeper cluster to use this image, perform the following steps:
Ensure that your workloads that use this Zookeeper cluster are compatible with Zookeeper 3.7.2
Set the
spec.image.repositoryandspec.image.tagfields of eachZookeeperClustercustom resource to reference the new image.
For example, you can usekubectl patchto upgrade the image in aZookeeperClusternamedzk-3that has been manually created in a namespacews-1as follows:CODEkubectl patch zookeepercluster -n ws-1 zk-3 --type='json' -p='[{"op": "replace", "path": "/spec/image/repository", "value": "ghcr.io/mesosphere/zookeeper"}, {"op": "replace", "path": "/spec/image/tag", "value": "0.2.15-d2iq"}]'
For more information, refer to Zookeeper Operator documentation: https://github.com/pravega/zookeeper-operator/blob/master/README.md#trigger-the-upgrade-manually
Upgrading the Kafka image reference in a KafkaCluster resource
The DKP catalog in 2.7 includes an updated Kafka 3.4.1 image, which does not contain CVEs present in earlier versions. This image is hosted at ghcr.io/banzaicloud/kafka:2.13-3.4.1. To update an existingKafkaClusterto use this image, perform the following steps:
Ensure that all workloads that use this Kafka cluster are compatible with this version of Kafka.
Identify the current version of Kafka, which is specified in the
.spec.clusterImagefield of theKafkaClusterresource.Ensure that the
spec.readOnlyConfigfield of theKafkaClustercontains ainter.broker.protocol.version=X.Y.Zline, whereX.Y.Zstands for the current version of Kafka, and no other lines setting this value are present in theKafkaClusterresource. This ensures all the brokers in the cluster can communicate with each other as the cluster is upgraded using the specified protocol version.
For example, if you use thekubectl editcommand to perform this step on aKafkaClustercurrently using theghcr.io/banzaicloud/kafka:2.13-2.8.1image, the resulting KafkaCluster manifest should resemble this:CODEapiVersion: kafka.banzaicloud.io/v1beta1 ... spec: clusterImage: "ghcr.io/banzaicloud/kafka:2.13-2.8.1" ... readOnlyConfig: | auto.create.topics.enable=false cruise.control.metrics.topic.auto.create=true cruise.control.metrics.topic.num.partitions=1 cruise.control.metrics.topic.replication.factor=2 inter.broker.protocol.version=2.8.1 ...For more information, refer to Kafka upgrade documentation: https://kafka.apache.org/documentation/#upgrade
Wait until
kafka-operatorreconciles the broker protocol change.kubectl get -A kafkaclustersshould reportClusterRunningstatus for this KafkaCluster.Set the
spec.clusterImageto the chosen image.
In the example above, theKafkaClustermanifest will look like this:CODE... spec: clusterImage: "ghcr.io/banzaicloud/kafka:2.13-3.4.1" ... readOnlyConfig: | ... inter.broker.protocol.version=2.8.1 ...Wait until
kafka-operatorfully applies the image change. After that, the cluster will run a new version of Kafka, but will still use the old protocol version.Verify the behavior and performance of this Kafka cluster and workloads that use it.
WARNING: This verification should not be postponed, because the next step can make a rollback to the old version of Kafka impossible.Bump the protocol version to the current one by modifying the
spec.readOnlyConfigfield so thatinter.broker.protocol.versionequals the new Kafka version.
In the example above, the `KafkaCluster` manifest will look like this:CODE... spec: clusterImage: "http://ghcr.io/banzaicloud/kafka:2.13-3.4.1" ... readOnlyConfig: | ... inter.broker.protocol.version=3.4.1 ...Wait until
kafka-operatorfully applies the protocol version change. The upgrade of the Kafka image for this cluster is now complete.