<p>I have Kuberenetes cluster hosted in Google Cloud. </p>

<p>I deployed my deployment and added an <code>hpa</code> rule for scaling. </p>

<pre><code>kubectl autoscale deployment MY_DEP --max 10 --min 6 --cpu-percent 60
</code></pre>

<p>waiting a minute and run <code>kubectl get hpa</code> command to verify my scale rule - As expected, I have 6 pods running (according to min parameter).</p>

<pre><code>$ kubectl get hpa
NAME                    REFERENCE                          TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
MY_DEP                  Deployment/MY_DEP                  &lt;unknown&gt;/60%   6         10        6          1m
</code></pre>

<p>Now, I want to change the min parameter:</p>

<pre><code>kubectl patch hpa MY_DEP -p '{"spec":{"minReplicas": 1}}'
</code></pre>

<p>Wait for 30 minutes and run the command:</p>

<pre><code>$ kubectl get hpa
NAME                    REFERENCE                          TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
MY_DEP                  Deployment/MY_DEP                  &lt;unknown&gt;/60%   1         10        6          30m
</code></pre>

<p><strong>expected replicas: 1, actual replicas: 6</strong></p>

<p>More information:</p>

<ol>
<li>You can assume that the system has no computing anything (0% CPU
utilization). </li>
<li>I waited for more than an hour. Nothing changed. </li>
<li>The same behavior is seen when i deleted the scaling rule and deployed it
again. The <code>replicas</code> parameter has not changed.</li>
</ol>

<h2>Question:</h2>

<p>If I changed the <code>MINPODS</code> parameter to "1" - why I still have 6 pods? How to make Kubernetes to actually change the <code>min</code> pods in my deployment?</p>

<blockquote>
  <p>If I changed the MINPODS parameter to "1" - why I still have 6 pods?</p>
</blockquote>

<p>I believe the answer is because of the <code>&lt;unknown&gt;/60%</code> present in the output. <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">The fine manual</a> states:</p>

<blockquote>
  <p>Please note that if some of the pod's containers do not have the relevant resource request set, CPU utilization for the pod will not be defined and the autoscaler will not take any action for that metric</p>
</blockquote>

<p>and one can see an example of <code>0% / 50%</code> in <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="nofollow noreferrer">the walkthrough page</a>. Thus, I would believe that since kubernetes cannot prove <em>what</em> percentage of CPU is being consumed -- neither above nor below the target -- it takes no action for fear of making <em>whatever</em> the situation is worse.</p>

<p>As for why there is a <code>&lt;unknown&gt;</code>, I would hazard a guess it's the dreaded heapster-to-metrics-server cutover that might be obfuscating that information from the kubernetes API. Regrettably, I don't have first-hand experience testing that theory, in order to offer you concrete steps beyond "see if your cluster is collecting metrics in a place that kubernetes can see them."</p>
