Answers: <p>The application boot up might be using resources above your set utilisation target before settling down. What you can do is to either:</p>
  <ul>
  <li>give it a bit more resource request</li>
  <li>increase the threshold of the HPA utilisation target</li>
  <li>increase the autoscaler interval check</li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2022-06-05T06:29:49.340Z
Answers: 2022-06-05T06:29:49.340Z
Answers: hazmei
Answers: <p>Try to change the current manifest instead of re-apply it</p>
  <p>Like:</p>
  <pre><code>kubectl apply set-last-applied
  </code></pre>
  <p>without the <code>replicas:</code> entry in the manifest</p>
  <p>Found here <a href="https://github.com/kubernetes/kubernetes/issues/67135#issuecomment-415983309" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/67135#issuecomment-415983309</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-11-07T14:37:40.317Z
Answers: 2024-11-07T14:37:40.317Z
Answers: schmichri
Answers: <p>To avoid the issue, remove the <code>replicas:</code> from the <code>Deployment</code> and define the HPA with your desired number of min and max replicas.</p>
  <p>Then, you can update the deployment manifest anytime.</p>
  <p>Example in official documentation: <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-12-14T21:13:12.520Z
Answers: 2024-12-14T21:13:12.520Z
Answers: Marco Caberletti
Body: <p>We have a manifest file that defines a set number of replicas and an autoscaler that scales them up. The problem we have is when we apply the manifest, it immediately scales the replicas down to the number in the manifest. This eventually is fixed by the autoscaler, but in the meantime, it's not great!</p>
  <p>Is there a way to run a manifest and ignore the <code>replica</code> parameter?</p>
  <p>We tried removing it, but then it scaled to the default count of 1.</p>
  
Comments: CC BY-SA 4.0
Comments: 2022-06-06T16:57:31.027Z
Comments: This problem feels disastrous in a system that has many more replicas than the manifest calls for. I'm very surprised there isn't a better answer to this.
Comments: mlissner
Tags: <kubernetes><autoscaling>
Title: How to apply k8s manifest without scaling replicas
UserDisplayName: mlissner
ThreadText: # How to apply k8s manifest without scaling replicas
  
  (Asked by: username_0 on 2022-06-03)
  
  We have a manifest file that defines a set number of replicas and an autoscaler that scales them up. The problem we have is when we apply the manifest, it immediately scales the replicas down to the number in the manifest. This eventually is fixed by the autoscaler, but in the meantime, it's not great!
  
  Is there a way to run a manifest and ignore the `replica` parameter?
  
  We tried removing it, but then it scaled to the default count of 1.
  
  **Tags:** kubernetes, autoscaling
  
  > **Comments:**
  > **username_0**: This problem feels disastrous in a system that has many more replicas than the manifest calls for. I'm very surprised there isn't a better answer to this.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2022-06-05. Score: 0
  
  The application boot up might be using resources above your set utilisation target before settling down. What you can do is to either:
  
  * give it a bit more resource request
  * increase the threshold of the HPA utilisation target
  * increase the autoscaler interval check
  
  
  ---
  
  ### Answer by username_2 on 2024-11-07. Score: 0
  
  Try to change the current manifest instead of re-apply it
  
  Like:
  
  ```
  kubectl apply set-last-applied
  
  ```
  
  without the `replicas:` entry in the manifest
  
  Found here <https://github.com/kubernetes/kubernetes/issues/67135#issuecomment-415983309>
  
  
  ---
  
  ### Answer by username_3 on 2024-12-14. Score: 0
  
  To avoid the issue, remove the `replicas:` from the `Deployment` and define the HPA with your desired number of min and max replicas.
  
  Then, you can update the deployment manifest anytime.
  
  Example in official documentation: <https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/>
  
  
  ---
  
  