Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KedaScaledJob is unable to scale due to invalid offset with kafka-trigger #2871

Closed
zaheer032 opened this issue Apr 1, 2022 · 4 comments
Closed
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity

Comments

@zaheer032
Copy link

zaheer032 commented Apr 1, 2022

Report

When we try to produce message on kafka topic we except new keda jobs to be created based on trigger specified(in our case kafka-trigger). However we can see that no jobs are getting created and consumer group also is not created,.

Since lagtreshold is specified as "1" and kept minreplicacount as "0" : one-job should be created whenever there is message on Kafka queue and should scale according to lagthreshold.
To add to the behaviour: there is no existing consumer group. When we manually add consumer group it starts working

Expected Behavior

Keda jobs should scale based on kafka-trigger

Actual Behavior

Keda consumer jobs should be created

Steps to Reproduce the Problem

  1. Create the kafka-scaledjob

{{- if .Values.ServiceTagsMessageConsumer.enabled -}}
{{ if .Values.keda.enabled -}}
apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
  name: {{ .Release.Name }}-tags-message-consumer
  namespace: {{ .Release.Namespace }}
spec:
  jobTargetRef:
    parallelism: 1
    template:
      spec:
        containers:
          - name: {{ .Values.assetServiceTagsMessageConsumer.name }}
            image: {{ .Values.image.repository }}
            args:
              - python
              - manage.py
              - tags_consumer
            imagePullPolicy: {{ .Values.image.pullPolicy }}
            env:
              - name: SSL_CA_LOCATION
                value: {{ .Values.kafka.sslCaDirMount }}/ca.crt
              - name: SSL_CA_DIR_MOUNT
                value: {{ .Values.kafka.sslCaDirMount }}
              - name: SSL_SECRET_NAME
                value: {{ .Values.kafka.sslSecretName }}
              - name: SSL_USER_KEY_LOCATION
                value: {{ .Values.kafka.sslUserCertDir }}/user.key
              - name: SSL_USER_CERT_LOCATION
                value: {{ .Values.kafka.sslUserCertDir }}/user.crt
              - name: SSL_USER_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: {{ .Release.Name }}-kafka-user-certs
                    key: user.password
              - name: SSL_USER_MOUNT_PATH
                value: {{ .Values.kafka.sslUserCertDir }}
              - name: ASSET_TAGS_CONSUMER_GROUP_ID
                value: {{ .Values.kafka.ASSET_TAGS_CONSUMER_GROUP_ID }}
              - name: KAFKA_ASSET_TAG_TOPIC
                value: {{ .Values.tags_consumer_service.consumption_topic }}
              {{- include "env" . | nindent 14 }}
            resources:
              {{- toYaml .Values.assetServiceTagsMessageConsumer.resources | nindent 14 }}
            volumeMounts:
              - name: user-certs
                mountPath: {{ .Values.kafka.sslUserCertDir }}
              - name: ca-certs
                mountPath: {{ .Values.kafka.sslCaDirMount }}
        volumes:
          - name: user-certs
            secret:
              secretName: {{ .Release.Name }}-kafka-user-certs
          - name: ca-certs
            secret:
              secretName: kafka-cluster-ca-cert
  pollingInterval: 60
  maxReplicaCount: 100
  successfulJobsHistoryLimit: 5
  failedJobsHistoryLimit: 5
  triggers:
    - type: kafka
      metadata:
        bootstrapServers: "kafka-kafka-bootstrap.kafka:9093"
        consumerGroup: "AssetTagConsumer"
        topic: {{ .Values.tags_consumer_service.consumption_topic }}
        lagThreshold: "1"
        offsetResetPolicy: latest
      authenticationRef:
        name: {{ .Release.Name }}-keda-trigger-auth-kafka-credential
  {{- end }}
{{- end }}
  1. Produce a message on kafka-topic

  2. Logs for Keda operator

invalid_offset

Logs from KEDA operator

invalid_offset

KEDA Version

2.6.1

Kubernetes Version

1.23

Platform

Amazon Web Services

Scaler Details

kafka-trigger

Anything else?

No response

@zaheer032 zaheer032 added the bug Something isn't working label Apr 1, 2022
@tomkerkhove tomkerkhove moved this to Proposed in Roadmap - KEDA Core Apr 1, 2022
@JorTurFer
Copy link
Member

JorTurFer commented Apr 2, 2022

Hi @zaheer032
I'm not an expert on kafka tbh, but I can see in KEDA logs that there are some errors related with any wrong configuration.
Invalid offset found .....

Could you check that whole message and verify that there is not any misconfiguration in KEDA or Kafka?

@zroubalik
Copy link
Member

Please check this related issues: #2612 #2033

@stale
Copy link

stale bot commented Jun 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Jun 3, 2022
@tomkerkhove
Copy link
Member

Please check this related issues: #2612 #2033

Closing as issue is stale and above mentioned issues are closed

Repository owner moved this from Proposed to Ready To Ship in Roadmap - KEDA Core Jun 7, 2022
@tomkerkhove tomkerkhove moved this from Ready To Ship to Done in Roadmap - KEDA Core Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale All issues that are marked as stale due to inactivity
Projects
Archived in project
Development

No branches or pull requests

4 participants