Temporal cron job on Kubernetes running on multiple pods


I have an use case where I have to run a cron job, which picks up a record from db, to see if I should a notification email to customer or not.
I deploy my service in Kubernetes, and if I have multiple pods running, how do I ensure that the same record is not picked up by multiple pods which run the cron workflow code ?

Temporal assures workflow id uniqueness across all executions in a namespace. Workflow executions are not tied to a specific worker process (pod that you deploy), but server makes sure only single execution can be in Running status with a certain workflow id. So for your use case if you have client app that tries to start the cron with workflow id and one with same is already running, that client call will be rejected.

Note that you can specify different workflow id reuse policies when you request workflow execution, one of them is terminate_if_running, in that case the currently running execution with that workflow id is terminated and a new one started.
Default is allow_duplicate which might be bit confusing name, but means that execution for a workflowid is allowed only if no other ones with that id are running.