<p>On a minikube I have installed KEDA and managed to scale up/down a small service I have created using the Postgres scaler.</p>
<p>After a while, the scaler stopped working, and I don't understand why.</p>
<p>Here's the spec from the ScaledObject yaml:</p>
<pre><code>spec:
    minReplicaCount: 0
    maxReplicaCount: 5
    pollingInterval: 30
    cooldownPeriod: 30
    scaleTargetRef:
        name: demo-service
    triggers:
        -   type: postgresql
            metadata:
                connection: &quot;postgresql://host.minikube.internal:5432&quot;
                userName: &quot;postgres&quot;
                passwordFromEnv: demo-service-secret-keda-password
                host: &quot;host.minikube.internal&quot;
                dbName: &quot;postgres&quot;
                sslmode: disable
                port: &quot;5432&quot;
                query: &quot;select value from keda where id = 1&quot;
                targetQueryValue: &quot;3&quot;
</code></pre>
<p>Postgres is running on Docker on the same machine, and here's the result of the query:</p>
<pre><code>postgres=# select value from keda where id = 1;                                                                                                                      value 
-------
     2
(1 row)
</code></pre>
<p>Looking at the logs of the Keda pod, I see:</p>
<pre><code>2022-11-07T14:48:59Z    ERROR   Reconciler error    {&quot;controller&quot;: &quot;scaledobject&quot;, &quot;controllerGroup&quot;: &quot;keda.sh&quot;, &quot;controllerKind&quot;: &quot;ScaledObject&quot;, &quot;scaledObject&quot;: {&quot;name&quot;:&quot;postgres-scaledobject&quot;,&quot;namespace&quot;:&quot;default&quot;}, &quot;namespace&quot;: &quot;default&quot;, &quot;name&quot;: &quot;postgres-scaledobject&quot;, &quot;reconcileID&quot;: &quot;06cbd2e8-93ac-43a1-8cf0-ac4852eac4be&quot;, &quot;error&quot;: &quot;HorizontalPodAutoscaler.autoscaling \&quot;keda-hpa-postgres-scaledobject\&quot; is invalid: spec.metrics[0].external.target.averageValue: Invalid value: resource.Quantity{i:resource.int64Amount{value:0, scale:0}, d:resource.infDecAmount{Dec:(*inf.Dec)(nil)}, s:\&quot;0\&quot;, Format:\&quot;DecimalSI\&quot;}: must be positive&quot;}
</code></pre>
<p>But I don't understand the error, because the value IS positive.
I did set it at one point to a negative value, but I have changed it multiple times since, and I have undeployed the ScaledObject and redeployed it.</p>
<p>I am not sure how to fix this, so any help is welcome.</p>
<p>Thanks.</p>

D. Joe
<p>Uninstalling and installing KEDA in my cluster helped.</p>
<blockquote>
<p>kubectl delete -f <a href="https://github.com/kedacore/keda/releases/download/v2.9.0/keda-2.9.0.yaml" rel="nofollow noreferrer">https://github.com/kedacore/keda/releases/download/v2.9.0/keda-2.9.0.yaml</a></p>
</blockquote>
<blockquote>
<p>kubectl apply --server-side   -f  <a href="https://github.com/kedacore/keda/releases/download/v2.9.0/keda-2.9.0.yaml" rel="nofollow noreferrer">https://github.com/kedacore/keda/releases/download/v2.9.0/keda-2.9.0.yaml</a></p>
</blockquote>
<p>I suppose that if you change the targetvalue of your trigger to something invalid it does not get deleted when you delete the ScaledObject somehow.</p>
