<hr />
<h1>Background</h1>
<p>I have a large Python service that runs on a desktop PC, and I need to have it run as part of a K8S deployment. I expect that I will have to make several small changes to make the service run in a deployment/pod before it will work.</p>
<hr />
<h1>Problem</h1>
<p>So far, if I encounter an issue in the Python code, it takes a while to update the code, and get it deployed for another round of testing. For example, I have to:</p>
<ul>
<li>Modify my Python code.</li>
<li>Rebuild the Docker container (which includes my Python service).</li>
<li><code>scp</code> the Docker container over to the Docker Registry server.</li>
<li><code>docker load</code> the image, update tags, and push it to the Registry back-end DB.</li>
<li>Manually kill off currently-running pods so the deployment restarts all pods with the new Docker image.</li>
</ul>
<p>This involves a lot of lead time each time I need to debug a minor issue. Ideally, I've prefer being able to just modify the copy of my Python code already running on a pod, but I can't kill it (since the Python service is the default app that is launched, with <code>PID=1</code>), and K8S doesn't support restarting a pod (to my knowledge). Alternately, if I kill/start another pod, it won't have my local changes from the pod I was previously working on (which is by design, of course; but doesn't help with my debug efforts).</p>
<hr />
<h1>Question</h1>
<p>Is there a better/faster way to rapidly deploy (experimental/debug) changes to the container I'm testing, without having to spend several minutes recreating container images, re-deploying/tagging/pushing them, etc? If I could find and mount (read-write) the Docker image, that might help, as I could edit the data within it directly (i.e. new Python changes), and just kill pods so the deployment re-creates them.</p>
<hr />

<p>There are two main options: one is to use a tool that reduces or automates that flow, the other is to develop locally with something like Minikube.</p>

<p>For the first, there are a million and a half tools but Skaffold is probably the most common one.</p>

<p>For the second, you do something like <code>( eval $(minikube docker-env) &amp;&amp; docker build -t myimagename . )</code> which will build the image directly in the Minikube docker environment so you skip steps 3 and 4 in your list entirely. You can combine this with a tool which detects the image change and either restarts your pods or updates the deployment (which restarts the pods).</p>

<p>Also FWIW using <code>scp</code> and <code>docker load</code> is very not standard, generally that would be combined into <code>docker push</code>.</p>
