<p>I need to deploy a spring boot application on google Kubernetes. The application depends on Optaplanner which need to compile some Java classes into bytecode on the fly at runtime, so JDK is needed.</p>
<p>How to deploy on a JDK-provided Kubernetes engine, instead of JRE?</p>

<p>You can create the Docker file and docker image with the JDK so that your application can use the JDK from the docker.</p>
<p>For spring boot example you can check out: <a href="https://github.com/spring-guides/gs-spring-boot-docker" rel="nofollow noreferrer">https://github.com/spring-guides/gs-spring-boot-docker</a></p>
<pre><code>package hello;
                        
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class Application {
    
    @RequestMapping(&quot;/&quot;)
    public String home() {
        return &quot;&lt;h1&gt;Spring Boot Hello World!&lt;/h1&gt;&quot;;
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
</code></pre>
<p>Example <strong>dockerfile</strong></p>
<pre><code>FROM openjdk:8-jdk
RUN addgroup --system spring &amp;&amp; adduser --system spring -ingroup spring
USER spring:spring
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;/app.jar&quot;]
</code></pre>
<p>You can refer this official Oracle example : <a href="https://docs.oracle.com/en-us/iaas/developer-tutorials/tutorials/spring-on-k8s/01oci-spring-k8s-summary.htm" rel="nofollow noreferrer">https://docs.oracle.com/en-us/iaas/developer-tutorials/tutorials/spring-on-k8s/01oci-spring-k8s-summary.htm</a></p>
