What is the relationship between Elasticsearh ES_Java_Opts and Kubernetes Resource Limits What is the relationship between Elasticsearh ES_Java_Opts and Kubernetes Resource Limits kubernetes kubernetes

What is the relationship between Elasticsearh ES_Java_Opts and Kubernetes Resource Limits


I am not a expert in k8s and docker but what I understand is that, docker container uses the host resources and using resource limit you can have a hard limit on the resources it can consume.

If you put a resource limit of 15GB, than overall your docker container can consume 15GB of host RAM.now whether it will share the file system cache with host or not depends on how you have configured your docker volume.

As docker container have the option to share the file system with host using the bind volume or have its own data volume(which is ephemeral and not suited for ES as its a stateful application). in first option it should share the file system cache with host and you should not increase the resource limit further(recommended as you have ES which is stateful) and in second option, as it will use its own file system you have to allocate RAM for its file system cache and have to increase RAM to 30 GB, but you have to give some space for Host OS as well.


Container will always see the node`s memory instead of the container one. In Kubernertes, even though you set a limit for the memory to a container, the container itself is not aware of this limit.

This has an effect on the applications that looks up for the memory available on the system and use that information to decide how memory it wants to reserve.

This is why you setup the JVM heap size. Without this specified the JVM will setup the maximum heap size based on the host/node total memory instead of the one available (that you`ve declared as limit) to the container.

Check out this article about how limits works in k8s.