1
votes

I explain my case.

I have three pods running in my Kubernetes. In one pod, there is a Flask framework running. In the two other pods, there is a Java application with a REST API. ( The Java application is the same on the two pods ).

My pod with Flask has to ask the two pods with the Java application individually using HTTP requests.

I have created a service that points toward my two pods with Java Application. When my pod with Flask uses the service to ask the two others, I just have one response.

How could I target my pods individually ? Is it possible in my case to get endpoints from the pod with Flask ? I could have x pods with my Java Application.

Best regards,

Nico.

2

2 Answers

1
votes

IMO, the right way to do this is to have 3 deployments each managing your pods individually each with a replica of 1.

  • One for your Flask app
  • One for your Java app
  • Another one for the same Java app.

If the Java apps are the only ones that you need to connect to from the Flask app you can expose those deployments with 2 different services that will manage the endpoints. Services are supposed to manage the endpoints unless you are trying to connect to an external endpoint.

0
votes
  • you can get endpoints separate for your pods kubectl get ep --all-namespaces
  • you dont need a k8s service if you are accessing things internally , you can use endpoints directly , but this is not recommneded , as the pods maybe re-created by RS

  • therefore , in this case you can define two clusterIP services for these pods , given that you have labeled your pods differently