<p><a href="https://i.stack.imgur.com/Co7j3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Co7j3.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/qI2xk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qI2xk.png" alt="enter image description here"></a></p>

<p>I am using python flask in GKE contianer and moemory is increasing inside pod. I have set limit to pod but it's getting killed. </p>

<p>I am thinking it's memory leak can anybody suggest something after watching this. As disk increase memory also increase and there are some page faults also.</p>

<p>Is there anything container side linux os (using python-slim base). Memory is not coming back to  os or python flask memory management issue ?</p>

<p>To check memory leak i have added stackimpact to application.</p>

<p><a href="https://i.stack.imgur.com/91Tlp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/91Tlp.png" alt="enter image description here"></a></p>

<p>Please help...!
Thanks in advance</p>

<p>If you added a resource memory limit to each GKE Deployment when the <a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-resource-requests-and-limits" rel="nofollow noreferrer">memory limit</a> was hit, the pod was killed, rescheduled, and should restarted and the other pods on the node should be fine.</p>

<p>You can find more information by running this command:</p>

<pre><code>kubectl describe pod &lt;YOUR_POD_NAME&gt;

kubectl top pods
</code></pre>

<p>Please note if you put in a memory request that is larger than the amount of memory on your nodes, the pod will never be scheduled.</p>

<p>And if the Pod cannot be <a href="https://cloud.google.com/kubernetes-engine/docs/troubleshooting#PodUnschedulable" rel="nofollow noreferrer">scheduled</a> because of insufficient resources or some configuration error You might encounter an error indicating a lack memory or another resource. If a Pod is stuck in Pending it means that it can not be scheduled onto a node.  In this case you need to delete Pods, adjust resource requests, or add new nodes to your cluster. You can find more information <a href="https://kubernetes.io/docs/user-guide/compute-resources/#my-pods-are-pending-with-event-message-failedscheduling" rel="nofollow noreferrer">here</a>.</p>

<p>Additionally, as per this <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/small-cluster-tuning#horizontal_pod_autoscaling" rel="nofollow noreferrer">document</a>, <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">Horizontal Pod Autoscaling</a> (HPA) scales the replicas of your deployments based on metrics like memory or CPU usage.</p>
