I'm facing with a issue in my spring boot service. After deploy it on kubernetes I have a Java Heap Space. I have set the next environment configuration on my deployment.yaml:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: JAVA_OPTS
value: "-Xms512M -Xmx512M -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1"
But after make a new deployment I'm still having the same issue because this way hasn't had effect. I have gone inside of my image and I have seen that the heap memory is around 200MB.
My image is working under openjdk 11. Any idea about why is not working correctly?
Thank you.
I'm guessing you just set that env variable, which does nothing, you need to add it to your RUN/ENTRYPOINT java command in your Dockerfile or as args for your kubernetes command.
Most likely something like
ENTRYPOINT java $JAVA_OPTS -jar <path to your jar>
would work