<p>API that is written in JAVA spring-boot was deployed in K8s with two pods and Its been 3 weeks that API is successfully running. But, last day it stoped working and produced 503 server unavailable. </p>

<p>K8s admin told us that Pods got recreating multiple time whole the day. Though it is started working after restarting my build from Drone, i want to know </p>

<ol>
<li>Which scenario can make Pods not working?</li>
<li>Why K8S is recreating Pods again and again?</li>
<li>If it is the memory issue, as i have developed this API in JAVA, doesn't JAVA's garbage collection work here?</li>
</ol>

<p>Regards,
Hearaman.</p>

Hearaman
<p>Which scenario can make Pods not working?</p>

<ol>
<li>Memory Limits, request Limits, quota in general</li>
<li>You Pod have a QoS ( K8S ) of Burstable meaning that it can be
destoyed to let other pods live</li>
<li>Node/ Workers are down or dained to be updated/maintained</li>
<li>You java Heap is causing the app to be destoyed ( generally that's
the case )</li>
<li>Liveness Probe Issues</li>
</ol>

<p>Why K8S is recreating Pods again and again?</p>

<ul>
<li>To make it available again ( You might have a Readiness Issue ) or
some volumes issues ( it depends )</li>
</ul>

<p>If it is the memory issue, as i have developed this API in JAVA, doesn't JAVA's garbage collection work here</p>

<ul>
<li><p>if you are using java 8, you might want to add some controls over the
Heap size when starting app as follow:</p>

<p>-XX:+PrintFlagsFinal 
-XX:+UnlockExperimentalVMOptions 
-XX:+UseCGroupMemoryLimitForHeap </p></li>
</ul>

<p>This is java 8+ feature so you might need to check java documentation</p>

<p>Hope this helps</p>
