<p>I have implemented HPA for all the pods based on CPU and it was working as expected. But when we did a maintenance of worker nodes, it seems tha HPA's got messed up as it failed to identify it. Do I need to disable HPA temporarily during maintenance and bring it up once the maitenance is over.</p>
<p>Please suggest</p>
<p>HPA Manifest -</p>
<pre><code>apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: pod-name-cpu
spec:
  maxReplicas: 6
  minReplicas: 2
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: pod-name
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 60
</code></pre>

dvlpr
<p>There is a <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#implicit-maintenance-mode-deactivation" rel="nofollow noreferrer">maintenance-mode</a> solution which says:</p>
<blockquote>
<p>You can implicitly deactivate the HPA for a target without the need to
change the HPA configuration itself. If the target's desired replica
count is set to 0, and the HPA's minimum replica count is greater than
0, the HPA stops adjusting the target (and sets the <code>ScalingActive</code>
Condition on itself to <code>false</code>) until you reactivate it by manually
adjusting the target's desired replica count or HPA's minimum replica
count.</p>
</blockquote>
<p><strong>EDIT:</strong></p>
<p>To explain more the above, the things you should do are:</p>
<ul>
<li><p>Scale your deployment to <code>0</code></p>
</li>
<li><p>Describe your <code>HPA</code></p>
</li>
<li><p>Notice that under the <code>Conditions:</code> section the <code>ScalingActive</code> will turn to <code>False</code> which will disable <code>HPA</code> until you set the replicas back to desired value</p>
</li>
<li><p>See more <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#appendix-horizontal-pod-autoscaler-status-conditions" rel="nofollow noreferrer">here</a></p>
</li>
</ul>
<p>Also, as you did not specify what exactly happened and what is the desired outcome you might also consider moving your workload into a different node.
<a href="https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#how-to-perform-disruptive-actions-on-your-cluster" rel="nofollow noreferrer">How to perform Disruptive Actions on your Cluster</a> has a few options for you to choose from.</p>
