If you specify a memory limit but no request, Kubernetes automatically sets
memory request as the same value.
If you specify a memory request but no limit, Kubernetes does not set any
memory limit, so your container should never be killed due to exceeding its
memory limit.
You said you are setting request of 30MB but didn't say anything about
limit -- are you setting a limit?

BTW we really should rename "OOMKilled" to something like
"MemoryLimitExceeded" to distinguish it from when a container is killed due
to the system *actually* running out of memory (killed due to system
OOM or userspace
out-of-resource handler
<https://kubernetes.io/docs/concepts/cluster-administration/out-of-resource/>
).


On Tue, Mar 28, 2017 at 9:39 AM, bg <griffin...@gmail.com> wrote:

> I have an image that is basic Java application. I'm trying to minimize the
> amount of memory I submit the Job with in Kubernetes.
>
> Using Java's -Xmx flag I limit the program to using 25MB of memory
> (-Xmx25m) and using docker I run the container with 30M of memory: docker
> run -m 30m <image_id>
>
> That works fine so I go and deploy my image (including the -Xmx25m flag)
> to Kubernetes as a Job with resource request of 30MB of memory and the pods
> keep terminating with Reason: OOMKilled and Exit Code: 137.
>
> So I start doubling the amount of memory requested: 64M, 128, 256, 512
> until finally the pods are successful at 512MB of memory!
>
> So my question is why would a program that can run in docker with 30MB of
> memory require 512MB of memory when submitted to a kubernetes cluster?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kubernetes-users+unsubscr...@googlegroups.com.
> To post to this group, send email to kubernetes-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
  • [kubernetes... bg
    • Re: [k... 'Tim Hockin' via Kubernetes user discussion and Q&A
      • Re... 'EJ Campbell' via Kubernetes user discussion and Q&A
    • Re: [k... 'David Oppenheimer' via Kubernetes user discussion and Q&A

Reply via email to