Best practice deploy web application calling script retrieve stdout

3/28/2018

I have a REST web service in Java that needs to call a Perl script. The Perl script takes a text file and returns output on stdout. I have a Dockerfile for this Perl script. I also have Dockerfile for the Java application. Ideally I would be able to scale the web service and the script independently based on load. What is a best practice solution for this? Do I:

  • Create a single pod with both. If so, how do I scale this independently? If that's not an option, how do I handle keep the web service running when the Perl script gets overloaded (e.g. runs out of memory).
  • Create two pods. How do I handle communication between the two?
-- inodb
docker
kubernetes

1 Answer

3/28/2018

The pod is the minimum deployable unit in Kubernetes, which is an scheduler of resources. That being said, if you need to scale those applications independently, you need to use two pods. Otherwise, they will belong to the same Pod, which is the thing that you scale up/down in kubernetes (normally, you use a Deployment object to do that).

Ideally, the Java application would connect to the perl application through the network using a Service object, which lets you expose a Pod to the rest of the cluster using a specific name.

-- Jose Armesto
Source: StackOverflow