title: Kubernetes Rolling Update not obeying 'maxUnavailable' replicas when redeployed in autoscaled conditions
body: <p>In a nutshell, most of our apps are configured with the following <code>strategy</code> in the Deployment - </p>
  
  <pre><code>  strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
  </code></pre>
  
  <p>The Horizonatal Pod Autoscaler is configured as so </p>
  
  <pre><code>spec:
    maxReplicas: 10
    minReplicas: 2
  </code></pre>
  
  <p>Now when our application was redeployed, instead of running a rolling update, it instantly terminated 8 of our pods and dropped the number of pods to <code>2</code> which is the min number of replicas available. This happened in a fraction of a second as you can see here.</p>
  
  <p><a href="https://i.stack.imgur.com/V7AVN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/V7AVN.png" alt="enter image description here"></a></p>
  
  <p>Here is the output of <code>kubectl get hpa</code> - </p>
  
  <p><a href="https://i.stack.imgur.com/ehlyV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ehlyV.png" alt="enter image description here"></a></p>
  
  <p>As <code>maxUnavailable</code> is 25%, shouldn't only about 2-3 pods go down at max ? Why did so many pods crash at once ? It seems as though rolling update is useless if it works this way.</p>
  
  <p>What am I missing ?</p>