<p>We are using the hpa feature of kubernetes and we want to control scale up and down time. After going through kubernetes document, I got know below properties will help to do that, but not much information with example and hard to understand.
Could any one please explain below properties with example or additional information like how we can control scale up and down time in kubernetes.     </p>

<blockquote>
  <p>--horizontal-pod-autoscaler-initial-readiness-delay<br>
  --horizontal-pod-autoscaler-cpu-initialization-period<br>
  --horizontal-pod-autoscaler-downscale-stabilization default in kubernates.</p>
</blockquote>

<p>To get definitive answers for what these flags do, the best way is to directly look at the source code.</p>

<p>Here are pointers to the relevant source code files:</p>

<ul>
<li><code>--horizontal-pod-autoscaler-initial-readiness-delay</code>: <a href="https://github.com/kubernetes/kubernetes/blob/939da5e9cf7a041fd5cdf992449372e7b9833162/pkg/controller/podautoscaler/replica_calculator.go#L50" rel="nofollow noreferrer"><code>kubernetes/pkg/controller/podautoscaler/replica_calculator.go</code></a></li>
<li><code>--horizontal-pod-autoscaler-cpu-initialization-period</code>: <a href="https://github.com/kubernetes/kubernetes/blob/939da5e9cf7a041fd5cdf992449372e7b9833162/pkg/controller/podautoscaler/replica_calculator.go#L50" rel="nofollow noreferrer"><code>kubernetes/pkg/controller/podautoscaler/replica_calculator.go</code></a></li>
<li><code>--horizontal-pod-autoscaler-downscale-stabilization</code>: <a href="https://github.com/kubernetes/kubernetes/blob/939da5e9cf7a041fd5cdf992449372e7b9833162/pkg/controller/podautoscaler/horizontal.go#L658" rel="nofollow noreferrer"><code>kubernetes/pkg/controller/podautoscaler/horizontal.go</code></a></li>
</ul>

<p>In general, the <code>--horizontal-pod-autoscaler-downscale-stabilization</code> allows to define the maximum frequency of downscale operations. With the default of 5 minutes, if the HPA scales down your app, it will not do another downscale for 5 minutes, even if the metrics suggest to scale down. This is to prevent reacting too quickly to short drops in traffic that would then need to be undone with expensive scale up operations just a very short time later.</p>

<p>The other two flags mainly define when a Pod should be considered ready or should started being monitored.</p>

<p>Also look at the <code>--horizontal-pod-autoscaler-sync-period duration</code> and <code>--horizontal-pod-autoscaler-tolerance</code> flags (all the flags are defined <a href="https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-controller-manager/app/options/hpacontroller.go" rel="nofollow noreferrer">here</a>).</p>
