<p>I am trying to figure out the ultimate best practices for using Java in Docker containers deployed using Kubernetes <strong>on local environments or while developing code</strong>. In the ideal state, Java developers should be able to move as fast as python/javascript developers, but I am having a hard time matching the speed (or even coming close).</p>

<p>At the moment, I have a working, manually deployed k8's cluster. My Java Spring project is built by maven after a build command is run manually (<code>mvn clean install</code>), then I run a script to make an image, after that I run a script to run minkube (if its not already running) and finally I have to <code>apply</code> a deployments manifest file (which launches the containers into the pods).</p>

<p>What I am missing:</p>

<ol>
<li>All of this is done manually (there is clear room to automate the process of building an image after code is built and to have k8s update using the new image).</li>
<li>Builds are manually specified (python relaunches on code save. No hot reloading to my knowledge in the java world).</li>
<li>I have yet to see an integration between a local development environment and a cloud hosted k8's cluster. Ideally, a dev would test locally until they are ready to deploy to the cloud. When they are ready, it would be awesome to click a button and have a cluster read from a remote registry that could pick up the docker image changes and reload.</li>
</ol>

<p>Sadly, <a href="https://github.com/GoogleContainerTools/skaffold" rel="noreferrer">Skaffold</a>, the tool that I would be excited to use does not work natively with Java.
Is there another tool that Java Devs are using to make their local deployments super fast and competitive with the DUCK languages (py, js)?</p>

Chad Van De Hey
<p>You can build a docker image directly from maven with <a href="https://github.com/spotify/docker-maven-plugin" rel="nofollow noreferrer">docker-maven-plugin</a>. Add to your <code>pom.xml</code>: </p>

<pre><code>&lt;build&gt;
  &lt;plugins&gt;
    ...
    &lt;plugin&gt;
      &lt;groupId&gt;com.spotify&lt;/groupId&gt;
      &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;VERSION GOES HERE&lt;/version&gt;
      &lt;configuration&gt;
        &lt;imageName&gt;example&lt;/imageName&gt;
        &lt;dockerDirectory&gt;docker&lt;/dockerDirectory&gt;
        &lt;resources&gt;
           &lt;resource&gt;
             &lt;targetPath&gt;/&lt;/targetPath&gt;
             &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
             &lt;include&gt;${project.build.finalName}.jar&lt;/include&gt;
           &lt;/resource&gt;
        &lt;/resources&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    ...
  &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p>I don't know precisely your use case, but deploying a k8's cluster in your dev machine is maybe overkill. You can test your docker images with <a href="https://docs.docker.com/compose/" rel="nofollow noreferrer">Docker compose</a></p>
