0
  • kubernetes version: 1.18.6
  • Dockerfile jdk:1.8_231
  • Dockerfile content:
FROM harbor.testcbi.com/base/centos-jdk8-ast
MAINTAINER dailiang<dailiang666666@gmail.com>
WORKDIR /data
COPY  cbp-user-1.0.0.jar /data/
COPY  bootstrap.properties /data/
EXPOSE 8081
ENTRYPOINT ["java","-jar","core-us-1.0.0.jar"]

ConfigMap yaml content:

enter image description here

my deployment yaml:

enter image description here

logs:

[root@master01 ~]# kubectl logs core-us-deployment-6b784c8d96-b9z8b

Improperly specified VM option 'InitialHeapSize=1024m -XX:MaxHeapSize=1024m -XX:MetaspaceSize=84m -XX:MaxMetaspaceSize=240m -XX:+HeapDumpOnOutOfMemoryError'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

and when I change the jvm args to -Xms1024m -Xmx1024m; Got the following error

[root@master01 ~]# kubectl logs core-us-deployment-6b784c8d96-krfhg
Invalid initial heap size: -Xms1024m -Xmx1024m -XX:MetaspaceSize=84m -XX:MaxMetaspaceSize=240m -XX:+HeapDumpOnOutOfMemoryError
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I have googled for a long time, but I still haven’t found the answer. Please help me!!!!

General Grievance
  • 4,555
  • 31
  • 31
  • 45
ming
  • 1
  • Could you try to do that in your pod as env variable? There is an example on [banzaicloud](https://banzaicloud.com/blog/java10-container-sizing/). Additionally take a look [here](https://stackoverflow.com/a/44645367/11977760), might be related to your issue. – Jakub Oct 01 '20 at 10:55
  • if I changed -Xms1024m -Xmx1024m , to => -Xms1024M -Xmx1024M ,Still get the same error; if I only a parameter -XX:MaxHeapSize=1024m,it started woking!!! – ming Oct 11 '20 at 04:50
  • my configmap core-us-map: '''apiVersion: v1 data: JAVA_OPTS: -XX:MaxHeapSize=1024m ''' it started working,But this is not what i need – ming Oct 11 '20 at 09:57
  • @Jakub If I set the parameters of the command in the following way, the pod can start normally: command: - sh - -c - java $(JAVA_OPTS) -jar /data/core-us-1.0.0.jar ```` if i remove "sh -c",pod will not start normally;As follows: ```` command: - java - $JAVA_OPTS - -jar - core-us-1.0.0..jar ```` why??????? – ming Oct 11 '20 at 10:11

0 Answers0