Persistent Kafka transacton-id across restarts on Kubernetes
The only way to guarantee the uniqueness of Pods
is to use StatefulSet.StatefulSets
will allow you to keep the number of replicas alive but everytime pod dies it will be replaced with the same host and configuration. That will prevent data loss that is required.
Service in Statefulset
must be headless
because since each pod is going to be unique, so you are going to need certain traffic to reach certain pods.
Every pod
require a PVC
(in order to store data and recreate whenever pod is deleted from that data).
Here is a great article describing why StatefulSet
should be used in similar case.