I am working on a Kubernetes integration of the database Apache IoTDB which supports a Cluster mode. Currently, to start a cluster each node needs to know the IP adresses of all other nodes in its "ensemble" upfront, before starting.
I think the default approach to this in Kubernetes would generally be to use a StatefulSet and a headless Service. And the startup loop I scratched would be something like this
- start each pod with a container which contains a "pre-start" script
- In the pre-start script wait until all other pods of the set are started and get all their ip adresses from the headless service)
- update the configs / env variables with all cluster ip adresses
- start the iotdb instance(s)
So the only question I have is for step 2: When do I know that all pods are started? Is the update of the DNS / A records of the headless Service atomic in the sense that I see all pods or no pod? OR do I have to query the API Server separately to see the number of replicas and then wait until I got all their records from the headless service?
Or is there a more kubernetes-like way to achieve that?
Thanks already!