<p>I am currently running a Flink session cluster (Kubernetes, 1 JobManager, 1 TaskManager, Zookeeper, S3) in which multiple jobs run.</p>

<p>As we are working on adding more jobs, we are looking to improve our deployment and cluster management strategies.  We are considering migrating to using job clusters, however there is reservation about the number of containers which will be spawned.  One container per job is not an issue, but two containers (1 JM and 1 TM) per job raises concerns about memory consumption.  Several of the jobs need high-availability and the ability to use checkpoints and restore from/take savepoints as they aggregate events over a window.</p>

<p>From my reading of the documentation and spending time on Google, I haven't found anything that seems to state whether or not what is being considered is really possible.</p>

<p>Is it possible to do any of these three things:</p>

<ol>
<li>run both the JobManager and TaskManager as separate processes in the same container and have that serve as the Flink cluster, or</li>
<li>run the JobManager and TaskManager as literally the same process, or</li>
<li>run the job as a standalone JAR with the ability to recover from/take checkpoints and the ability to take a savepoint and restore from that savepoint?</li>
</ol>

<p>(If anyone has any better ideas, I'm all ears.)</p>

John Stone
<p>One of the responsibilities of the job manager is to monitor the task manager(s), and initiate restarts when failures have occurred. That works nicely in containerized environments when the JM and TMs are in separate containers; otherwise it seems like you're asking for trouble. Keeping the TMs separate also makes sense if you are ever going to scale up, though that may moot in your case.</p>

<p>What might be workable, though, would be to run the job using a LocalExecutionEnvironment (so that everything is in one process -- this is sometimes called a Flink minicluster). This path strikes me as feasible, if you're willing to work at it, but I can't recommend it. You'll have to somehow keep track of the checkpoints, and arrange for the container to be restarted from a checkpoint when things fail. And there are other things that may not work very well -- see <a href="https://stackoverflow.com/q/59459513/2000823">this question</a> for details. The LocalExecutionEnvironment wasn't designed with production deployments in mind.</p>

<p>What I'd suggest you explore instead is to see how far you can go toward making the standard, separate container solution affordable. For starters, you should be able to run the JM with minimal resources, since it doesn't have much to do. </p>
