Upgrading Bitnami Kafka Helm Chart from v23 to v24
Introduction
This document will walk you through how to upgrade Kafka from Chart version v23 to chart version v24. The major changes to the chart do not allow you to leverage the same deployment of Kafka. Therefore some surgery has to be done.
The process below is based on a HomeLab. Some variables may need to be updated for your use case.
Process
-
Deploy Chart v24 with the following values and command:
image:#ensure this image is the same as your v23 deploymenttag: 3.5.1-debian-11-r7externalZookeeper:servers: zookeeper.porp-zookeeper.svc.cluster.localzookeeper:enabled: falsekraft:enabled: falsebroker:replicaCount: 3persistence:size: 1Gicontroller:replicaCount: 0persistence:size: 1Gilisteners:#listeners configuration should match previous client and interbroker authentication mechanismsclient:containerPort: 9092protocol: PLAINTEXTname: CLIENTsslClientAuth: ""interbroker:containerPort: 9094protocol: PLAINTEXTname: INTERNALsslClientAuth: ""Terminal window helm install kafka24 bitnami/kafka -f values.yaml -n porp-kafka --version 24.0.3 -
Ensure that all 3 PersistentVolume’s Reclaim Policy are set to
Retain

If they are not set to
Reclaimyou can simply edit the configuration of the PersistentVolume and changepersistentVolumeReclaimPolicy: Delete→persistentVolumeReclaimPolicy: Retain
-
Delete the
data-kafka24-broker-0,data-kafka24-broker-1,data-kafka24-broker-2PersistentVolumeClaims (this might require settingFinalizerstonull) -
Repeat the following steps for each of your replicas:
Terminal window REPLICA=0OLD_PVC="data-kafka23-${REPLICA}"NEW_PVC="data-kafka24-broker-${REPLICA}"PV_NAME=$(kubectl get pvc $OLD_PVC -n porp-kafka -o jsonpath="{.spec.volumeName}")NEW_PVC_MANIFEST_FILE="$NEW_PVC.yaml"# Create new PVC manifestkubectl get pvc $OLD_PVC -n porp-kafka -o json | jq ".metadata.name = \"$NEW_PVC\"| with_entries(select([.key] |inside([\"metadata\", \"spec\", \"apiVersion\", \"kind\"])))| del(.metadata.annotations, .metadata.creationTimestamp,.metadata.finalizers, .metadata.resourceVersion,.metadata.selfLink, .metadata.uid)" > $NEW_PVC_MANIFEST_FILE
🚨 At this point ensure that the files were created and validate their contents
- Delete the v23
StatefulSet - Delete all v23
PersistentVolumeClaims - Edit the v23
PersistentVolumesand remove theClaimRefobject (they should all show asAvailablefollowing this)

-
Apply the files created during step #4
Terminal window kubectl apply -f data-kafka24-broker-0.yaml,data-kafka24-broker-1.yaml,data-kafka24-broker-2.yaml

-
Restart the
kafka24-brokerStatefulSet -
At this point
kafka24should be connected to the Volumes which were previously used by the old deployment. I have validated this by listing the topics from the previous deployment and I can see that the topic I created is availableTerminal window $ kafka-topics.sh --bootstrap-server localhost:9092 --listporp
🚨 As part of this process any connection strings that reference the old Kafka deployment will have to change