prevent GKE from evicting pod when running memory intensive rake task

3/29/2018

I have a kubernetes deployment object that creates 3 application pods with a rails application.

I want to attach to one of the pods to run a fairly memory intensive rake task, however kubernetes evicts the pod due to memory constraints before the task can be completed.

What is the best practice to go about solving this? my cluster consists of 3 nodes with a combined total of 11+GB of RAM

would setting a resource request in the deployment object help?

requests: memory: "1024Mi"

-- snowflakekiller
google-kubernetes-engine
kubernetes

1 Answer

3/31/2018

Add a memory request to the service so the pod has enough guaranteed memory to run the task and try again. AS you said that request may help, if your service doesn't need more than 1024Mi to run. Be sure that you put a sane memory limit that both let's the task run without using up the memory that the pod and node need to run correctly.

It is possible too that you don't have enough memory to complete the task.

-- Jordi Miralles
Source: StackOverflow