Kube behavior when more memory is required?

1/28/2020

This question is regarding the Kubernetes behavior when request need more memory than allocated to Pod containing php app . If GC is not able to free memory and request need more memory due to which pods becomes unresponsive or request gets timed out , will kube restart the pod in itself ?

In case swap memory is given, will kube try to use it before it restart the pod.

-- user3198603
kubernetes
memory
php

1 Answer

1/28/2020

Swap is not supported with Kubernetes and it will refuse to start if active. Request values for pod resources cannot be overcommitted so if a pod requests 1GB and no node has 1GB available (compared to total RAM minus the requests on all pods scheduled to that node) then the pod will remain unscheduled until something changes. Limits can be overcommitted, but Kubernetes is not involved in that process. It just sets the memory limit in the process cgroup. Out of memory handling works like it always does on Linux, if the kernel decides it is out of memory, then it triggers a thing called the oomkiller which ranks processes and kills the worst one.

-- coderanger
Source: StackOverflow