<p>We have a GKE cluster (1.11) and implemented HPA based on memory utilization for pods. During our testing activity, we have observed HPA behavior is not consistent, HPA is not scaling pods even though the target value is met. We have also noticed that, HPA events is not giving us any response data ( either scaling or downscaling related info).</p>
<h1>Example</h1>
<p><strong>kubectl get hpa</strong></p>
<p><code>NAME    REFERENCE  TARGETS   MINPODS   MAXPODS   REPLICAS   AGE</code></p>
<p><code>com-manh-cp-organization  Deployment/com-manh-cp-organization 95%/90%   1         25        1          1d</code></p>
<p><strong>kubectl describe hpa com-manh-cp-organization</strong></p>
<pre><code>Name:                                                     com-manh-cp-organization
Namespace:                                                default
Labels:                                                   app=com-manh-cp-organization
                                                          stereotype=REST
Annotations:                                              kubectl.kubernetes.io/last-applied-configuration:
                                                            {&quot;apiVersion&quot;:&quot;autoscaling/v2beta1&quot;,&quot;kind&quot;:&quot;HorizontalPodAutoscaler&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;app&quot;:&quot;com-manh-cp-organizatio...
CreationTimestamp:                                        Tue, 12 Feb 2019 18:02:12 +0530
Reference:                                                Deployment/com-manh-cp-organization
Metrics:                                                  ( current / target )
  resource memory on pods  (as a percentage of request):  95% (4122087424) / 90%
Min replicas:                                             1
Max replicas:                                             25
Deployment pods:                                          1 current / 1 desired
Conditions:
  Type            Status  Reason              Message
  ----            ------  ------              -------
  AbleToScale     True    ReadyForNewScale    the last scale time was sufficiently old as to warrant a new scale
  ScalingActive   True    ValidMetricFound    the HPA was able to successfully calculate a replica count from memory resource utilization (percentage of request)
  ScalingLimited  False   DesiredWithinRange  the desired count is within the acceptable range
Events:           &lt;none&gt;

</code></pre>
<ul>
<li>Cluster version : 1.11.6</li>
<li>Cloud service : GKE</li>
<li>Metric : memory</li>
<li>Target : targetAverageUtilization</li>
</ul>
<p>Any inputs will be much appreciated and let us know if we can debug HPA implementation.</p>
<p>Thanks.</p>

<p>There is a tolerance on the values for the threshold in HPA when calculating the replica numbers as specified in this <a href="https://github.com/kubernetes/kubernetes/blob/a2f4f585afba0c57b432772c6358cb1b2727fb5f/pkg/controller/podautoscaler/replica_calculator.go#L39" rel="nofollow noreferrer">link.</a></p>

<p>This tolerance is by default 0.1. And in your configuration you might not be hitting the threshold when you put 90% due to this. I would recommend you to change the metrics to 80% and see if it is working. </p>
