<p>Hi I have question about golang micro service via kubernetes container. Example I have 2 deploy of code name A and B.</p>
<ol>
<li>A have 1 pod do a sent request to create document in B service.</li>
<li>B have autoscaling config between 1 - 5 pod waiting for request from A and process to create a document in many collection.</li>
</ol>
<p>Sometime service A have error &quot;EOF&quot; from service B and I go to check log in service B couldn't find error that makes pod terminate or crashloopbackoff status from kubectl terminal it like service B just stop running this process.</p>
<p>I wonder cause of error &quot;EOF&quot; is about autoscaling config in B service in my understanding high traffic to B service have to scale up pod to 5 pod but when traffic go down pod must scale down too.</p>
<p>It is possible if any process working in pod that would to scale down it terminated before process success?</p>

<p>Make sure your service B can do a graceful shutdown.</p>
<p>On scale down, or delete, the pod will first receive a TERM signal. Then, after a grace period, it will send a KILL if needed.</p>
<p>Your service should respect TERM and stop all internal processes (goroutines in your case) and then terminate. If you manage there will be no need for a KILL signal.</p>
<p>It's described in the <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination" rel="nofollow noreferrer">Pod Lifecycle documentation</a></p>
