kubernetesapache-kafkagoogle-kubernetes-enginepersistent-volumesstrimzi

How to change PV storageClass of Strimzi kafka cluster


I am new at Strimzi and want to get some advice

We have kafka cluster in GKE. It is deployed with Strimzi and we have it on all stands including prod env.

Our configuration of PVC that used by

kafka:
    template:
      pod:
    .....
    storage:
      type: jbod
      volumes:
      - id: 0
        type: persistent-claim
        size: {{ .Values.kafka.storageSize | quote }}
        deleteClaim: true

And storage that zookeeper is using:

zookeeper:
...
    storage:
      type: persistent-claim
      size: {{ .Values.zookeeper.storageSize | quote }}
      deleteClaim: true

With this configuration PVs are created with ReclaimPolicy: Delete, because it is default Storage Class and I need to change it to custom (with ReclaimPolicy: Retain)

And now i need to save all data in topics and change storageClass of both broker's and zookeeper's storages.

So my question is what should I do and in what order because if I just change the class through .spec.storage.class then PVC will be released and PV would be deleted.


Solution

  • You can't really change the storage class for existing volumes.

    There are several options how to work around it for Kafka:

    For ZooKeeper, none of these are really possibly. There are only hacky ways how to change the storage type. But maybe you can use the KRaft-migration that you would anyway need to go through sooner or later as an opportunity to change the storage type.