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.repository
andspec.image.tag
fields of eachZookeeperCluster
custom resource to reference the new image.
For example, you can usekubectl patch
to upgrade the image in aZookeeperCluster
namedzk-3
that has been manually created in a namespacews-1
as 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 existingKafkaCluster
to 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.clusterImage
field of theKafkaCluster
resource.Ensure that the
spec.readOnlyConfig
field of theKafkaCluster
contains ainter.broker.protocol.version=X.Y.Z
line, whereX.Y.Z
stands for the current version of Kafka, and no other lines setting this value are present in theKafkaCluster
resource. 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 edit
command to perform this step on aKafkaCluster
currently using theghcr.io/banzaicloud/kafka:2.13-2.8.1
image, 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-operator
reconciles the broker protocol change.kubectl get -A kafkaclusters
should reportClusterRunning
status for this KafkaCluster.Set the
spec.clusterImage
to the chosen image.
In the example above, theKafkaCluster
manifest 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-operator
fully 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.readOnlyConfig
field so thatinter.broker.protocol.version
equals 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-operator
fully applies the protocol version change. The upgrade of the Kafka image for this cluster is now complete.