1

I have a use case in which front-end application in sending a file to back-end service for processing. And at a time only one request can be processed by backend service pod. And if multiple request came service should autoscale and send that request to new Pod. So I am finding a way in which I can spawn a new POD against each request and after completion of processing by backend service pod it will return the result to front-end service and destroy itself. So that each pod only process a single request at a time.

I explore the HPA autoscaling but did not find any suitable way. Open to use any custom metric server for that, even can use Jobs if they are able to fulfill the above scenario.

So if someone have knowledge or tackle the same use case then help me so that I can also try that solution. Thanks in advance.

1
  • Thanks both. But there is one more catch as even if create a new available pod using some HPA or service account, even then we cant guaranteed that by using back-end service name it will redirect to that available pod as service do the loadbalncing automatically. Unless we use the new pod IP in place of service name with in the front-end to call in place of service name. The request can go any where. Commented Feb 6, 2019 at 5:32

2 Answers 2

1

There's not really anything built-in for this that I can think of. You could create a service account for your app that has permissions to create pods, and then build the spawning behavior into your app code directly. If you can get metrics about which pods are available, you could use HPA with Prometheus to ensure there is always at least one unoccupied backend, but that depends on what kind of metrics your stuff exposes.

Sign up to request clarification or add additional context in comments.

Comments

1

As already said, there is no built in way for doing this , you need to find custom way to achive this.

One solution can be use of service account and http request to api server to create back end pod as soon as your service is received by front end pod, check status of back end pod and once it is up, forward request to back end.

Second way i can think of using some temp storage ( db or hostpath volume ) and write cronejob in your master to poll that storage and depending on status spawn pod having job container.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.