2

I'm looking a way to call /test endpoint of my service on all the pods I could have (essentially I have only 3 pods).

It's is that possible?

I tried a Cloud Function that calls my balanced ip (https://10.10.10.10:1111/test) however this will send the request to only one pod i.e Pod1 therefore Pod2 and Pod3 don't execute /test and I need the request to be executed on all 3 pods.

It doesn't matter what this /test does I just need to be executed on all pods.

Any hint to achieve this would be awesome.

Dr3ko
  • 313
  • 1
  • 5
  • 19
  • These Pod1..3 are replicas of a deployment or they're distinctly created Pods? – Ali Tou May 27 '20 at 04:16
  • Those pods are replicas. – Dr3ko May 27 '20 at 04:17
  • is this for liveness of the pod? i mean for health/error check? – Amit Naik May 27 '20 at 04:23
  • No, this is to do a little process that needs to be executed on each pod. – Dr3ko May 27 '20 at 04:26
  • create separate pods and separate endpoints for each of those – Arghya Sadhu May 27 '20 at 04:40
  • I don't think the ability that you want is possible by design. Replicas of a deployment are meant to be a way for horizontally scaling, and basically there mustn't be any difference between Pods that receive a request to do a job. So it's the expected behavior that you see only one of them is called when sending a request. If this request must be dispatched to an exact Pod (in your case, all of Pods), so this Pod is different than others. I'm agree with the comment above to create separate Pods for this purpose. – Ali Tou May 27 '20 at 04:47
  • 3
    Does this answer your question? [Kubenetes: Is it possible to hit multiple pods with a single request in Kubernetes cluster](https://stackoverflow.com/questions/49612412/kubenetes-is-it-possible-to-hit-multiple-pods-with-a-single-request-in-kubernet) – Arghya Sadhu May 27 '20 at 05:00
  • If I'm reading your question correctly, this conversation on GitHub might be relevant to your interests: https://github.com/kubernetes/kubernetes/issues/18755 – ingernet May 27 '20 at 19:11

1 Answers1

1

There is no specific way, you'll have to use the Kubernetes API to get all the pod IPs and make a request to each individually. This is usually a sign of some wonky software design though.

coderanger
  • 52,400
  • 4
  • 52
  • 75