KafkaSource failing to connect with Kafka broker with Unable to decode key error

Solution Verified - Updated -

Issue

  • KafkaSource is unable to connect with Kafka broker to source events and scale Knative Service. In kafka-source-dispatcher following error is observed:
{"@timestamp":"2024-09-24T06:17:52.858Z","@version":"1","message":"App info kafka.consumer for consumer-knative-kafka-source-b6f2eea9-8e88-4ab0-801c-1847ff65c157-2 unregistered","logger_name":"org.apache.kafka.common.utils.AppInfoParser","thread_name":"vert.x-worker-thread-1","level":"INFO","level_value":20000}
Sep 24, 2024 6:17:52 AM io.vertx.core.impl.ContextBase
SEVERE: Unhandled exception
org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:825)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:666)
    at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:614)
    at dev.knative.eventing.kafka.broker.dispatcherloom.LoomConsumerFactory.create(LoomConsumerFactory.java:28)
......
Caused by: org.apache.kafka.common.errors.InvalidConfigurationException: Invalid PEM keystore configs
Caused by: org.apache.kafka.common.errors.InvalidConfigurationException: Private key could not be loaded
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: Unable to decode key
.......
Caused by: java.security.InvalidKeyException: Unable to decode key
    at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:137)
    at java.base/sun.security.pkcs.PKCS8Key.<init>(PKCS8Key.java:96)
    at java.base/sun.security.rsa.RSAPrivateCrtKeyImpl.<init>
.......
Caused by: java.io.IOException: algid parse error, not a sequence
    at java.base/sun.security.x509.AlgorithmId.parse(AlgorithmId.java:390)
    at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:112)
    ... 38 more 

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4
  • Red Hat OpenShift Serverless

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content