<p>We are using AKS 1.19.11 version and would like to know whether we could enable the configurable scaling behavior in AKS also as <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">Horizontal Pod Autoscaler</a>.</p>
<p>If yes, the current hpa setting used is with <code>apiversion: autoscaling/v1</code>. Is it possible to configure these hpa behavior properties with these api version?</p>

Vowneee
<p>If you ask specifically about <code>behavior</code> field, the answer is: <strong>no, it's not available in <code>apiVersion: autoscaling/v1</code></strong> and if you want to leverage it, you need to use <code>autoscaling/v2beta2</code>. It's clearly stated <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-configurable-scaling-behavior" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>Starting from v1.18 the v2beta2 API allows scaling behavior to be
configured through the HPA behavior field.</p>
</blockquote>
<p>If you have doubts, you can easily check it on your own by trying to apply a new <code>HorizontalPodAutoscaler</code> object definition, containing this field, but instead of required <code>autoscaling/v2beta2</code>, use <code>autoscaling/v1</code>. You should see the error message similar to the one below:</p>
<pre><code>error: error validating &quot;nginx-multiple.yaml&quot;: error validating data: [ValidationError(HorizontalPodAutoscaler.spec): unknown field &quot;behavior&quot; in io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerSpec, ValidationError(HorizontalPodAutoscaler.spec): unknown field &quot;metrics&quot; in io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerSpec]; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p>As you can see both <code>metrics</code> and <code>behavior</code> fields in <code>spec</code> are not valid in <code>autoscaling/v1</code> however they are perfectly valid in <code>autoscaling/v2beta2</code> API.</p>
<p>To check whether your <strong>AKS</strong> cluster supports this API version, run:</p>
<pre><code>$ kubectl api-versions | grep autoscaling
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
</code></pre>
<p>If your result is similar to mine (i.e. you can see <code>autoscaling/v2beta2</code>), it means your <strong>AKS</strong> cluster supports this API version.</p>
