<p>I'm newbie to Kubernetes.
I wonder how to launch a container programmatically in Java (or Scala), and feed the input stream of the process with some binary data.  Probably I need a job.  I've found how to launch a job, but I have no control over its input stream.</p>
<p>I can use any convenient Kubernetes client library.</p>
<p>I need it to launch a <a href="https://github.com/GoogleContainerTools/kaniko#how-does-kaniko-work" rel="nofollow noreferrer">kaniko</a> container and feed its input stream with a <code>.tar.gz</code> file generated on the fly (via the <code>--context tar://stdin</code> option).</p>
<p>I could do an <code>exec</code> over an existing <code>kaniko</code> container, but don't know to launch the container appropriately for this purpose, because the container doesn't include any shell.</p>

david.perez
<p>You can use <code>kubectl run</code> to create a pod and connect its stdin with option <code>-i</code>.
Your container should termiate gracefully when the work is done.</p>
<p>Example:</p>
<pre><code>echo &quot;echo foo&quot; | kubectl run -i busybox --image=busybox --restart=Never 
</code></pre>
<p>Reference:</p>
<p><a href="https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_run/" rel="nofollow noreferrer">https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_run/</a></p>
