<p>Because Kubernetes handles situations where there's a typo in the job spec, and therefore a container image can't be found, by leaving the job in a running state forever, I've got a process that monitors job events to detect cases like this and deletes the job when one occurs.</p>

<p>I'd prefer to just stop the job so there's a record of it. Is there a way to stop a job?</p>

Brent212
<p>Not really, no such mechanism exists in Kubernetes yet afaik.</p>

<p>You can workaround is to ssh into the machine and run a: (if you're are using Docker)</p>

<pre><code># Save the logs
$ docker log &lt;container-id-that-is-running-your-job&gt; 2&gt;&amp;1 &gt; save.log
$ docker stop &lt;main-container-id-for-your-job&gt;
</code></pre>

<p>It's better to stream log with something like <a href="https://www.fluentd.org/" rel="nofollow noreferrer">Fluentd</a>, or <a href="https://github.com/gliderlabs/logspout" rel="nofollow noreferrer">logspout</a>, or <a href="https://www.elastic.co/products/beats/filebeat" rel="nofollow noreferrer">Filebeat</a> and forward the logs to an ELK or EFK stack.</p>

<p>In any case, I've opened <a href="https://github.com/kubernetes/kubernetes/issues/69311" rel="nofollow noreferrer">this</a></p>
