<p>My SpringBoot application is scheduled to run at 1 UTC each day for some data collection and put that in the database. We are using Kubernetes and we have two pods accessing the same database. The database is at some other location for which we have a connection string which is the same in both pods.</p>
<p>The problem is both of my pods wake up at 1 UTC and add duplicate entries in the database? How can I ensure that only one pod is talking to the database?  Is this application is not ideal for k8s deployment?</p>

<p>I know this is old, but for anybody else, look into <a href="https://github.com/lukas-krecan/ShedLock" rel="nofollow noreferrer">ShedLock</a>.  It handles locking across distributed nodes and is pretty easy to implement.</p>
