title: Kubernetes Pod OOMKilled Solution
body: <p>I have a service running on Kubernetes processing files passed from another resource. Single file size can vary between 10MB - 1GB.</p>
  
  <p>Recently I've been seeing the pod dead because of OOMKilled Error:</p>
  
  <pre><code>State: Running
  Started: Sun, 11 Nov 2018 07:28:46 +0000
  Last State: Terminated
  Reason: OOMKilled
  Exit Code: 137
  Started: Fri, 09 Nov 2018 18:49:46 +0000
  Finished: Sun, 11 Nov 2018 07:28:45 +0000
  </code></pre>
  
  <p>I mitigate the issue by bumping the resource (Memory) limit on the pod. But I am concerning whenever there is a traffic or file size spike, we will run into this OOMKilled issue again. But if I set the memory limit too high, I am concerning it will cause trouble on the host of this pod. </p>
  
  <p>I read through the best practices given by Kubernetes: <a href="https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/#best-practices" rel="noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/#best-practices</a>. But I am not sure by adding --eviction-hard and --system-reserved=memory could resolve the issue. </p>
  
  <p>Has anyone had experience with a similar issue before? </p>
  
  <p>Any help would be appreciated.</p>