<p>Actually I'm using the <strong>jib-maven-plugin</strong> to create Docker container for my application. Then I'm going to deploy it to Google servers where we have a <strong>Kubernetes</strong> environment.</p>
<p>Actually we are playing with the java env. variables from the <strong>jib-maven-plugin</strong>'s config (<strong>pom.xml</strong>):</p>
<pre><code>&lt;jvmFlags&gt;
  &lt;jvmFlag&gt;-XX:MinRAMPercentage=60.0&lt;/jvmFlag&gt;
  &lt;jvmFlag&gt;-XX:MaxRAMPercentage=80.0&lt;/jvmFlag&gt;
  &lt;jvmFlag&gt;-XX:+HeapDumpOnOutOfMemoryError&lt;/jvmFlag&gt;
  &lt;jvmFlag&gt;-Djdk.tls.client.protocols=&quot;TLSv1,TLSv1.1,TLSv1.2&quot;&lt;/jvmFlag&gt;
&lt;/jvmFlags&gt;
</code></pre>
<p>Now we would like to move these configurations to our <strong>deployment yml</strong> file, we found something like:</p>
<pre><code>env:
- name: JAVA_OPTS
  value: &quot;-XX:MinRAMPercentage=60.0 -XX:MaxRAMPercentage=90.0 -XX:+HeapDumpOnOutOfMemoryError&quot;
...
resources: 
    limits:
        memory: 512Mi
    requests:
        memory: 256Mi
</code></pre>
<p>but it seems that if we remove these configs from the jib-maven-plugin's config file and move them to the yml file they are simply not working. The container starts without having any effects of the mentioned settings.</p>
<p>We are using open JDK 11, that may be also important.</p>
<p>How it's possible to control the Java env. options from the deployment file?</p>
<p>Thank you so much for your help, have a nice day!</p>

Arnold Robert Turdean
<p>The problem is that you're setting <code>JAVA_OPTS</code> and not <code>JDK_JAVA_OPTIONS</code>.
<code>JAVA_OPTS</code> is used by some application servers like Tomcat, but <a href="https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID-3B1CE181-CD30-4178-9602-230B800D4FAE" rel="nofollow noreferrer">the JDK itself uses JDK_JAVA_OPTIONS</a>.</p>
<p>Therefore, a working Kubernetes yaml would be something like:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
    ...
spec:
  template:
    metadata:
        ...
    spec:
      containers:
        - name: ...
          image: ...
          env:
            - name: JDK_JAVA_OPTIONS
              value: -XX:MinRAMPercentage=60 -XX:MaxRAMPercentage=80 -XX:+HeapDumpOnOutOfMemoryError -Djdk.tls.client.protocols=&quot;TLSv1,TLSv1.1,TLSv1.2&quot;
</code></pre>
