Search code examples
javaspring-bootkubernetesgoogle-cloud-platformspring-cloud-gcp

Kubernetes : Multiple pods result in a scheduler being invoked multiple times


This is a clarification question

So I'm working on a java spring boot application, where I have a scheduler running which would be calling an external api every one hour

This application is deployed in GCP kubernetes

The issue is, when there are multiple pods running, it's being invoked multiple times. For example, at 12 pm, if there are 5 pods running the external api is being called 5 times, which shouldn't be happening.

What is the best way to fix this issue ?

Some documentation would be appreciated


Solution

  • Distributed Lock

    use redis

    use zookeeper