Change JVM Heap Size with Logstash Helm Chart

I'm currently using the Logstash Kubernetes Helm chart, linked below:

There doesn't seem to be a way to increase the JVM heap size using the values.yaml file.

I have also tried setting the environment variable LS_JAVA_OPTS as a parameter in the initial start up of the container by setting it's value to be LS_JAVA_OPTS="-Xmx4g -Xms2g". I have been able to confirm that this environment variable is set by running echo $LS_JAVA_OPTS. Its values are not used in the start up of the of the JVM, reflected with this command:

bash-4.2$ ps -aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
logstash       1  191  4.2 6844236 661540 ?      Ssl  20:31   1:11 /bin/java -Xms1g -Xmx1g -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -

I can't manually edit the file /usr/share/logstash/config/jvm.options because I need to be able to run logstash on start up of the container. Is there any other way to change the JVM Heap size option?

Although the LS_JAVA_OPTS environment variable is set, is it exported from your shell to sub-shells?

Test with:

export | grep LS_JAVA_OPTS

If it doesn't show up there, you'll need to export it:

export LS_JAVA_OPTS

This is my output when I run the first command:

sh-4.2$ export | grep LS_JAVA_OPTS
export LS_JAVA_OPTS="-Xmx4g -Xms2g"

The way that I'm setting the environment variable is by using a values file that overrides the upstream helm chart. This is what I have in my values file.

  config:
    ls.java.opts: "-Xmx4g -Xms2g"
  resources:
    limits:
      memory: 8Gi
    requests: 
      memory: 8Gi
  replicaCount: 2

So this environment variable gets created on creation of the container itself.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.