<p>I am trying to create a KEDA scaled job based on RabbitMQ queue trigger but encountered an issue when pods are not scaling at all.</p>
<p>I have created a following Scaled job and lined up messages in the queue but no pods are created. I see this <strong>message: Scaling is not performed because triggers are not active</strong></p>
<p>What could be reason that pods are not scaling at all? Thanks for help.</p>
<p>And in Keda logs I see:</p>
<pre><code>2021-12-29T13:50:19.738Z    INFO    scalemetrics    Checking if ScaleJob Scalers are active {&quot;ScaledJob&quot;: &quot;celery-rabbitmq-scaledjob-2&quot;, &quot;isActive&quot;: false, &quot;maxValue&quot;: 0, &quot;MultipleScalersCalculation&quot;: &quot;&quot;}
2021-12-29T13:50:19.738Z    INFO    scaleexecutor   Scaling Jobs    {&quot;scaledJob.Name&quot;: &quot;celery-rabbitmq-scaledjob-2&quot;, &quot;scaledJob.Namespace&quot;: &quot;sandbox-dev&quot;, &quot;Number of running Jobs&quot;: 0}
2021-12-29T13:50:19.738Z    INFO    scaleexecutor   Scaling Jobs    {&quot;scaledJob.Name&quot;: &quot;celery-rabbitmq-scaledjob-2&quot;, &quot;scaledJob.Namespace&quot;: &quot;sandbox-dev&quot;, &quot;Number of pending Jobs &quot;: 0}
</code></pre>
<p>--</p>
<pre><code>apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: &gt;
      {&quot;apiVersion&quot;:&quot;keda.sh/v1alpha1&quot;,&quot;kind&quot;:&quot;ScaledJob&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;celery-rabbitmq-scaledjob-2&quot;,&quot;namespace&quot;:&quot;sandbox-dev&quot;},&quot;spec&quot;:{&quot;failedJobsHistoryLimit&quot;:5,&quot;jobTargetRef&quot;:{&quot;activeDeadlineSeconds&quot;:3600,&quot;backoffLimit&quot;:6,&quot;completions&quot;:1,&quot;parallelism&quot;:5,&quot;template&quot;:{&quot;spec&quot;:{&quot;containers&quot;:[{&quot;command&quot;:[&quot;/bin/bash&quot;,&quot;-c&quot;,&quot;CELERY_BROKER_URL=amqp://$RABBITMQ_USERNAME:$RABBITMQ_PASSWORD@rabbitmq.sandbox-dev.svc.cluster.local:5672
      celery worker -A test_data.tasks.all --loglevel=info -c 1 -n
      worker.all&quot;],&quot;env&quot;:[{&quot;name&quot;:&quot;APP_CFG&quot;,&quot;value&quot;:&quot;test_data.config.dev&quot;},{&quot;name&quot;:&quot;C_FORCE_ROOT&quot;,&quot;value&quot;:&quot;true&quot;},{&quot;name&quot;:&quot;RABBITMQ_USERNAME&quot;,&quot;valueFrom&quot;:{&quot;secretKeyRef&quot;:{&quot;key&quot;:&quot;rabbitmq-user&quot;,&quot;name&quot;:&quot;develop&quot;}}},{&quot;name&quot;:&quot;RABBITMQ_PASSWORD&quot;,&quot;valueFrom&quot;:{&quot;secretKeyRef&quot;:{&quot;key&quot;:&quot;rabbitmq-pass&quot;,&quot;name&quot;:&quot;develop&quot;}}}],&quot;image&quot;:&quot;767487149142.dkr.ecr.us-east-1.amazonaws.com/test-data-celery:DEV-2021.12.27.0&quot;,&quot;imagePullPolicy&quot;:&quot;IfNotPresent&quot;,&quot;lifecycle&quot;:{&quot;postStart&quot;:{&quot;exec&quot;:{&quot;command&quot;:[&quot;/bin/sh&quot;,&quot;-c&quot;,&quot;echo
      startup \u003e\u003e
      /tmp/startup.log&quot;]}},&quot;preStop&quot;:{&quot;exec&quot;:{&quot;command&quot;:[&quot;/bin/sh&quot;,&quot;-c&quot;,&quot;echo
      shutdown \u003e\u003e
      /tmp/shutdown.log&quot;]}}},&quot;name&quot;:&quot;celery-backend&quot;,&quot;resources&quot;:{&quot;limits&quot;:{&quot;cpu&quot;:&quot;1700m&quot;,&quot;memory&quot;:&quot;3328599654400m&quot;},&quot;requests&quot;:{&quot;cpu&quot;:&quot;1600m&quot;,&quot;memory&quot;:&quot;3Gi&quot;}},&quot;securityContext&quot;:{&quot;allowPrivilegeEscalation&quot;:false,&quot;privileged&quot;:false,&quot;readOnlyRootFilesystem&quot;:false},&quot;terminationMessagePath&quot;:&quot;/tmp/termmsg.log&quot;,&quot;terminationMessagePolicy&quot;:&quot;File&quot;,&quot;volumeMounts&quot;:[{&quot;mountPath&quot;:&quot;/tmp&quot;,&quot;name&quot;:&quot;temp&quot;},{&quot;mountPath&quot;:&quot;/var/run/secrets/kubernetes.io/serviceaccount&quot;,&quot;name&quot;:&quot;default-token-s7vl6&quot;,&quot;readOnly&quot;:true}]}]}}},&quot;maxReplicaCount&quot;:100,&quot;pollingInterval&quot;:5,&quot;rolloutStrategy&quot;:&quot;gradual&quot;,&quot;successfulJobsHistoryLimit&quot;:5,&quot;triggers&quot;:[{&quot;metadata&quot;:{&quot;host&quot;:&quot;amqp://guest:guest@rabbitmq.sandbox-dev.svc.cluster.local:5672/vhost&quot;,&quot;mode&quot;:&quot;QueueLength&quot;,&quot;queueName&quot;:&quot;celery&quot;,&quot;value&quot;:&quot;1&quot;},&quot;type&quot;:&quot;rabbitmq&quot;}]}}
  creationTimestamp: '2021-12-29T13:11:15Z'
  finalizers:
    - finalizer.keda.sh
  generation: 3
  managedFields:
    - apiVersion: keda.sh/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:finalizers: {}
        f:spec:
          f:jobTargetRef:
            f:template:
              f:metadata:
                .: {}
                f:creationTimestamp: {}
          f:scalingStrategy: {}
        f:status:
          .: {}
          f:conditions: {}
      manager: keda
      operation: Update
      time: '2021-12-29T13:11:15Z'
    - apiVersion: keda.sh/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:spec:
          .: {}
          f:failedJobsHistoryLimit: {}
          f:jobTargetRef:
            .: {}
            f:activeDeadlineSeconds: {}
            f:backoffLimit: {}
            f:completions: {}
            f:template:
              .: {}
              f:spec:
                .: {}
                f:containers: {}
          f:maxReplicaCount: {}
          f:pollingInterval: {}
          f:rolloutStrategy: {}
          f:successfulJobsHistoryLimit: {}
          f:triggers: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: '2021-12-29T13:11:15Z'
    - apiVersion: keda.sh/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:spec:
          f:jobTargetRef:
            f:parallelism: {}
      manager: node-fetch
      operation: Update
      time: '2021-12-29T13:37:11Z'
  name: celery-rabbitmq-scaledjob-2
  namespace: sandbox-dev
  resourceVersion: '222981509'
  selfLink: &gt;-
    /apis/keda.sh/v1alpha1/namespaces/sandbox-dev/scaledjobs/celery-rabbitmq-scaledjob-2
  uid: 9013295a-6ace-48ba-96d3-8810efde1b35
status:
  conditions:
    - message: ScaledJob is defined correctly and is ready to scaling
      reason: ScaledJobReady
      status: 'True'
      type: Ready
    - message: Scaling is not performed because triggers are not active
      reason: ScalerNotActive
      status: 'False'
      type: Active
    - status: Unknown
      type: Fallback
spec:
  failedJobsHistoryLimit: 5
  jobTargetRef:
    activeDeadlineSeconds: 3600
    backoffLimit: 6
    completions: 1
    parallelism: 1
    template:
      metadata:
        creationTimestamp: null
      spec:
        containers:
          - command:
              - /bin/bash
              - '-c'
              - &gt;-
                CELERY_BROKER_URL=amqp://$RABBITMQ_USERNAME:$RABBITMQ_PASSWORD@rabbitmq.sandbox-dev.svc.cluster.local:5672
                celery worker -A test_data.tasks.all --loglevel=info -c 1
                -n worker.all
            env:
              - name: APP_CFG
                value: test_data.config.dev
              - name: C_FORCE_ROOT
                value: 'true'
              - name: RABBITMQ_USERNAME
                valueFrom:
                  secretKeyRef:
                    key: rabbitmq-user
                    name: develop
              - name: RABBITMQ_PASSWORD
                valueFrom:
                  secretKeyRef:
                    key: rabbitmq-pass
                    name: develop
            image: &gt;-
              111.dkr.ecr.us-east-1.amazonaws.com/test-data-celery:DEV-2021.12.27.0
            imagePullPolicy: IfNotPresent
            lifecycle:
              postStart:
                exec:
                  command:
                    - /bin/sh
                    - '-c'
                    - echo startup &gt;&gt; /tmp/startup.log
              preStop:
                exec:
                  command:
                    - /bin/sh
                    - '-c'
                    - echo shutdown &gt;&gt; /tmp/shutdown.log
            name: celery-backend
            resources:
              limits:
                cpu: 1700m
                memory: 3328599654400m
              requests:
                cpu: 1600m
                memory: 3Gi
            securityContext:
              allowPrivilegeEscalation: false
              privileged: false
              readOnlyRootFilesystem: false
            terminationMessagePath: /tmp/termmsg.log
            terminationMessagePolicy: File
            volumeMounts:
              - mountPath: /tmp
                name: temp
              - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
                name: default-token-s7vl6
                readOnly: true
  maxReplicaCount: 100
  pollingInterval: 5
  rolloutStrategy: gradual
  scalingStrategy: {}
  successfulJobsHistoryLimit: 5
  triggers:
    - metadata:
        host: amqp://guest:guest@rabbitmq.sandbox-dev.svc.cluster.local:5672/vhost
        mode: QueueLength
        queueName: celery
        value: '1'
      type: rabbitmq
</code></pre>

Anton Kim
<p><a href="https://stackoverflow.com/a/67319005/2777988">mode may not work in some cases.</a></p>
<p>Try changing</p>
<pre><code>- metadata:
    host: amqp://guest:guest@rabbitmq.sandbox-dev.svc.cluster.local:5672/vhost
    mode: QueueLength
    queueName: celery
    value: '1'
</code></pre>
<p>to</p>
<pre><code>- metadata:
    host: amqp://guest:guest@rabbitmq.sandbox-dev.svc.cluster.local:5672/vhost
    queueName: files
    queueLength: '1'
</code></pre>
