A
A
aagzip2022-03-14 00:43:28
Amazon Web Services
aagzip, 2022-03-14 00:43:28

How to correctly limit the execution of a function in multiple replicas of a pod?

Good afternoon.

There is an application deployed in EKS AWS, a backend, with several replicas, from the front you can initialize the launch of a rather long and heavy operation. The problem is that if several people access different replicas, then they can run this operation several times at the same time, which is rather pointless (Now it's worth checking in the backend code). How to correctly restrict execution so that if an operation is performed on one of the replicas, it is interrupted on others?

At the moment, only a shared directory (EFS for example) between containers and checking for the presence of a file in it, for example, comes to mind. But it looks pretty clumsy.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vadim, 2022-03-15
@aagzip

Since you have EKS/AWS, it is best to use the Parameter Store, where you will give access to your pods through eks service accounts. They will read parameters (variables) to and from the value when running their functionality. If the value is locked/changed by the first pod, then the operations will follow a different path accordingly.
https://docs.aws.amazon.com/eks/latest/userguide/i...

A
Alexander Karabanov, 2022-03-14
@karabanov

Set locks in some kind of consul or zookeeper or etcd.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question