<p>Is there any way I can exec into the container, then edit some code (ex: add some log, edit come configuration file, etc) and restart the container to see what happens?</p>
<p>I tried to search for this but found nothing helpful.</p>
<p>The point is, I want to do a quick debug, not to do a full cluster deployment.</p>

Tanapat Sainak
<p>Some programs (like ie. nginx) support configuration reload without restarting their process, with these you can just <code>kubectl exec</code> change config and send a signal to master process (ie. <code>kubectl exec &lt;nginx_pod&gt; kill -HUP 1</code>). It is a feature of the software though, so many will not take that into account.</p>

<p>Containers are immutable by design, so they restart with a clean state each time. That said, with no simple way of doing this, there are hackish ways to achieve it.</p>

<p>One I can think of involves modifying the image on the node that will then restart the container. If you can ssh into the node and access docker directly, you can identify the container with a modified file and commit these changes with <code>docker commit</code> under the same tag. At that point your local container with that tag has your changes baked in so if you restart it (not reschedule, as it could start on different node), it will come up with your changes (assuming you do not use <code>pullPolicy: always</code>).</p>

<p>Again, not the way it's meant to be used, but achievable.</p>
