<p>New to container and kubernetes. </p>

<p>I'm trying to set thing up so we have the parity of the local development all the way through prod.</p>

<p>Skaffold seems to be a good way to do this but I'm confused by a few small pieces of the examples and 'ideal workflow'</p>

<p>Referencing <a href="https://github.com/GoogleContainerTools/skaffold/tree/master/examples/nodejs" rel="nofollow noreferrer">https://github.com/GoogleContainerTools/skaffold/tree/master/examples/nodejs</a></p>

<p>The dockerfile they give uses nodemon. Wouldn't this same container be used in prod? Wouldn't it be bad to be running nodemon in prod?</p>

<p>How do I set up a kubernetes local development environment with live file sync and use the same resources (in order to have idempotency) for production?</p>

<p>You are absolutely right. Using nodemon in a production container is not recommended. Instead, you generally want different images or different entrypoints for dev vs staging vs production. There are two options to solve this:</p>

<p><strong>1. Multiple Dockerfiles</strong><br>
You can configure profiles in Skaffold and tell Skaffold to use a different Dockerfile during the build step: <a href="https://skaffold.dev/docs/how-tos/profiles/" rel="nofollow noreferrer">https://skaffold.dev/docs/how-tos/profiles/</a></p>

<p><strong>2. Single Dockerfile + Dev Overrides</strong><br>
If you do not want to manage multiple Dockerfiles, you could use a dev tool that supports dev overrides. DevSpace (<a href="https://github.com/devspace-cloud/devspace" rel="nofollow noreferrer">https://github.com/devspace-cloud/devspace</a>) for example differentiates between <code>devspace deploy</code> and <code>devspace dev</code> which applies certain overrides, e.g. overriding the entrypoint of the image. In this case you could specify 2 npm scrips in your package.json and start dev mode with the entrypoint <code>npm start dev</code> and the production mode using <code>npm start</code>.</p>
