If those options are not passed, the Java VM will take the memory limit from the node on which the pod is running and completely ignore the pod memory limits when no "-Xmx" parameter is passed.
In Java 10 Docker support has further improved: https://www.opsian.com/blog/java-on-docker/
And full support will hopefully be reached in Java 11, the first Long Term Support version following the new numbering scheme.
Java VMs 9 and 8 (131 and above) need the following options:
If those options are not passed, the Java VM will take the memory limit from the node on which the pod is running and completely ignore the pod memory limits when no "-Xmx" parameter is passed.
See https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits for details.
Another issue is the number of threads allocated for Java VM background tasks is far too high as the VM does not recognise the CPU limits (it gets the #CPU from the node): https://engineering.squarespace.com/blog/2017/understanding-linux-container-scheduling
In Java 10 Docker support has further improved: https://www.opsian.com/blog/java-on-docker/ And full support will hopefully be reached in Java 11, the first Long Term Support version following the new numbering scheme.