<p>I have a running container with a running app.</p>

<p>Now</p>

<pre><code> kubectl exec -it &lt;deployment&gt; bash
</code></pre>

<p>This container exposes port 80, and I want to debug some code starting a new process on port 80 - how?</p>

<p>if I do <code>kill &lt;PID&gt;</code>, then the exec shell terminates with:</p>

<p>command terminated with exit code 137</p>

Chris G.
<p>When you run your container it will run until the main process (defined on <code>command</code> field of the container spec) exit. When you run the <code>kill</code> command the container is marked as complete.</p>

<p>To debug like this you should run your application without starting the main application. You can run <code>kubectl run myappdebug -it --image=YOUR_IMAGE bash</code> than you'll be able to debug it.</p>

<p>After you finish it, remember to remove the deployment with your debug: <code>kubectl del deployment/myappdebug</code></p>
