<p>I have a spring boot application and I have created a deployment yaml file for this.
Now I have assigned it resources :</p>
<pre><code>resources:
            requests:
              memory: &quot;200Mi&quot;
              cpu: &quot;250m&quot;
            limits:
              memory: &quot;655Mi&quot;
              cpu: &quot;500m&quot;
</code></pre>
<p>and I have created my autoscalar as:</p>
<pre><code>kubectl autoscale deployment demo-app --cpu-percent=50 --min=1 --max=10
</code></pre>
<p>Now my issue is when my app starts, CPU utilization for pod reached almost 100%(during startup only for 5-10 mins and then return to normal) and hence my autoscalar creates a new pod.</p>
<p>But what I want is it should wait for a specific period after the startup of pod(for the readiness probe to be completed), then only it creates new pods if needed</p>

<p>There is a flag  <code>--horizontal-pod-autoscaler-cpu-initialization-period</code>
The readiness delay can also be introduced: <code>--horizontal-pod-autoscaler-initial-readiness-delay</code> and you can use  metric loop time, <code>--horizontal-pod-autoscaler-sync-period</code> to calculate the total delay.</p>
<p>These flags can help you set values so you can avoid problem of auto scaling during app initialization.</p>
<p>Read <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#algorithm-details" rel="nofollow noreferrer">here</a></p>
