title: How does pod replica scaling down work in Kubernetes Horizontal Pod Autoscaler?
body: <p>My understanding is that in Kubernetes, when using the Horizontal Pod Autoscaler, if the <code>targetCPUUtilizationPercentage</code> field is set to 50%, and the average CPU utilization across all the pod's replicas is above that value, the HPA will create more replicas. Once the average CPU drops below 50% for some time, it will lower the number of replicas.<br><br> <strong>Here is the part that I am not sure about:</strong> 
  <br>What if the CPU utilization on a pod is 10%, not 0%?Will HPA still terminate the replica?<br> 10% CPU isn't much, but since it's not 0%, some task is currently running on that pod. If it's a long lasting task (several seconds) and HPA decides to terminate the pod, that task will not be finished.</p>
  
  <p>Does the HPA terminate pods only if the CPU utilization on them is 0% or does it terminate them whenever it sees that the value is below <code>targetCPUUtilizationPercentage</code>? </p>
  
  <p>How does HPA decide which pods to remove?<br>
  Thank you!</p>