Configuring ClusterId via Custom Resources: Exploring Options #10082
Replies: 6 comments 26 replies
-
The cluster ID is generated as unique. So I'm not sure what is the exact problem you are trying to solve. |
Beta Was this translation helpful? Give feedback.
-
So after running in to an issue with our KRaft cluster, we ended up needing to restore our cluster from a backup. Our B/DR system uses velero to backup our PVCs & PVs and relies on FluxCD to restore the k8s resources to the same point in time as the backup was made. This implies that strimzi's However this is not a given due to the fact that the clusterID is randomly generated. This makes restoring a strimzi Kafka cluster from data disks a painful process with a race-condition after FluxCD applies the Kafka CR (between the user setting the clusterID within the Kafka.status subresource and strimzi's cluster-operator starting the cluster). I'm not sure what the benefit of having the clusterID be random is tbh and would really like to see the Kafka CR spec expanded to allow manually setting a clusterID value. An alternative could also be to change the operator to not generate a random ID but rather something deterministic based on the name, possibly requiring the configuration of a random-seed strimzi-wide. Is there any reason not to allow manually setting this value, seeing as you currently can do it by directly manipulating Kafka.status which just seems like an absolute hack tbh. Slack conversation about restoring and the clusterID problem: https://cloud-native.slack.com/archives/CMH3Q3SNP/p1720463076090579?thread_ts=1720455627.117929&cid=CMH3Q3SNP |
Beta Was this translation helpful? Give feedback.
-
Hi. |
Beta Was this translation helpful? Give feedback.
-
IMO this is such a glaring hole/blockers in migrating to kraft(when zookeeper is to be deprecated in strimzi 0.46). It is often quite easy to delete deployments from k8s (people fat-fingering commands). The only reliable way to persist information IMO (in kubernetes or without it) is using reliable block storage. I was expecting that deploying (termed as recreating the cluster earlier in the thread) would mean kafka brokers would read their clusterId from the underlying block storage (i.e kubernetes persistent volume/persistent volume claims) but that is not the case with strimzi/kraft. Even after retaining the persistent volume claims, the clusterId changes rendering the data on the disks useless and a broken cluster. Also I think keeping a critical cluster attribute (i.e. clusterId) inside a kubernetes resource is a bad design. That means I can't reliably restore kafka just from the backup of the drives? I need to save the instantiated kubernetes crd resources too? |
Beta Was this translation helpful? Give feedback.
-
I faced a similar issue. If anyone else is having this problem of restoring Zookeeper pods/data to a previous Kafka cluster I can go into more detail, but it is possible to set the (In my case I had lost the majority of my old ZK cluster data but retained 2:5 PVs (Id's "5" and "6" in |
Beta Was this translation helpful? Give feedback.
-
I’m trying to create a brand new Kafka cluster in KRaft mode using the Strimzi operator and ArgoCD for deployment. I’ve specified a custom clusterId under .status.clusterId in both the Kafka CR and the KafkaNodePool CRs (for broker and controller), but after syncing via ArgoCD, the cluster spins up with a random clusterId instead of the one I provided. As per the solution suggested in this github issue, I was wondering at what point I should annotate the Kafka CR with strimzi.io/pause-reconciliation="true" if I want the cluster to retain my specified clusterId when i creating my cluster from scratch. From what I gather, reconciliation needs to be paused so that my clusterId isn’t overwritten, but I’m unsure how to align that with ArgoCD’s sync process — it always ends up showing a drift and the cluster uses a new ID. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Strimzi generates a unique clusterId for each Kafka cluster it manages. This identifier can be retrieved using the
kubectl get kafka
command, where you'll observe a randomly generated string by the Strimzi operator.kubectl get kafka my-cluster-2 -n strimzi-2 -o=jsonpath='{.status.clusterId}'
Similarly, you can obtain the clusterId for Kafka node pools with:
kubectl get kafkanodepool my-pool-2 -o=jsonpath='{.status.clusterId}'
Now, let's discuss the possibility of overriding the clusterId with a user-defined value via Strimzi's CR configurations. Is this feature currently supported?
This will be useful for scenarios where you want more control over the cluster id. One such example could be creating stretch clusters where all brokers across different Kubernetes environments must use the same cluster id.
Beta Was this translation helpful? Give feedback.
All reactions