<p>When the HPA scales up it creates new pods, when it scales down those new pods are terminated and HPA keeps the oldest ones. Can I configure something to say to HPA to terminate the oldest pods and keep some newest?</p>

ianprogrammer
<p>As @ianprogrammer mentioned</p>
<blockquote>
<p>create a monitor of Kotlin coroutines into code and when the
Kubernetes make the health check it checks the status of my
coroutines. When the coroutine is not active
<a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">HPA</a>  restarts the pod.</p>
</blockquote>
<p>Also as @mdaniel adviced you may follow <a href="https://github.com/kubernetes/kubernetes/issues/4301" rel="nofollow noreferrer">this issue of scheduler</a>.</p>
<p>See also similar problem: <a href="https://github.com/kubernetes/kubernetes/issues/45509" rel="nofollow noreferrer">scaling-deployment-kubernetes</a>.</p>
