Does K8S container use file cache of host os

12/18/2019

Sorry for my poor english.

I'm tuning java vm that work in k8s pod.

Normally java vm shouldn't use all memory. Some memory should used by kernel for cache, buffer, resource management and so on. I knew container share host os kernel. The question is Does resource limit of pods include kernel memory such as file cache.

Thanks.

-- Wenhao Ni
jvm-hotspot
kubernetes
memory

2 Answers

12/18/2019

No, those kinds of buffers are not tracked per process and so are not bound by cgroups settings. I think the vfs cache specifically is shared globally after namespace processing but not 100% sure.

-- coderanger
Source: StackOverflow

12/18/2019

As the question you asked, I assumed you have searched about how to setup limitation for Memory in K8S -> https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#how-pods-with-resource-limits-are-run

In this section you will know the limitation you set would be convert to docker command(if you use docker in k8s), spec.containers[].resources.limits.memory -> --memory=""

and if you check the official document about kernel memory in docker -> https://docs.docker.com/config/containers/resource_constraints/#--kernel-memory-details which hasnt mentioned in k8s document. So I assume the value should be the default value for different type of linux system.

-- Vampire_D
Source: StackOverflow