<p>I'm building a microservices application using Kubernetes as a containers orchestrator. The app is up and running now but i have an other issue. That is in my services, i have a scheduled task running daily and when service get deployed, multiple service instances will run (by set replica number), that created multiple tasks running at the same time.
What i expect is only ONE instance of service task will be running rather than multiple. Is there any technique to handle this case?</p>
<h1>Technologies Stack</h1>
<ol>
<li>Kubernetes</li>
<li>Asp.net core to build Micro service</li>
<li>Bedrock implementation for CI/CD</li>
<li>Fabrikate</li>
<li>Traefik as a load balancer</li>
</ol>
<p>Please help me with this, Thanks!</p>

Yen Nguyen
<p>You have 2 ways of solving this problem:</p>

<p>1) Use task coordination in your application. Like there is a lock and only application owning a lock can run task. Take a look towards <a href="https://data-flair.training/blogs/zookeeper-locks/" rel="nofollow noreferrer">ZooKeeper</a> for a distributed lock logic. This is the preferred solution.</p>

<p>2) Use Kubernetes CronJob which runs daily.</p>
