<p>I have a container that performs some actions over some data. This container is heavy in memory and CPU resources, and I want it to start only an on-demand basis.</p>

<p>As an example, with docker-compose, out of Kubernetes, I use it this way:</p>

<pre><code>docker-compose run heavycontainer perform.sh some-action
</code></pre>

<p>The container performs the action and ends.</p>

<p>In Kubernetes I want this container to perform the actions it provides, but in response to some messages (AMQP messages, created by other containers). I have a container that listens for messages. My first thought was a pod with two containers: listener and performer. But I don't know whether is possible or not start a container from another.</p>

<p>Init or sidecar containers doesn't seem a solution. And I prefer to avoid creating a custom image to inject the listener into the performer.</p>

<p>Is there any way to achieve this?</p>

<p><strike>
I hope it help you.</p>

<ul>
<li><p>The pod need to <code>run regularly</code>, <a href="https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#creating-a-cron-job" rel="nofollow noreferrer">CronJob</a></p></li>
<li><p>The pod need to <code>run on demand</code>, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="nofollow noreferrer">Job</a></strike></p></li>
</ul>

<p>Firstly, I apologize you about my wrong answer. </p>

<p>I understand what you want now, and I think it can be available to run multiple containers in same pod. <a href="https://blog.openshift.com/patterns-application-augmentation-openshift/" rel="nofollow noreferrer">Patterns for Application Augmentation on OpenShift</a> is helpful for you. </p>

<p>PS. OpenShift is Enterprise Kubernetes, so you can think OpenShift is same with Kubernetes.</p>
