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

Invalid value SASL_PLAINTEXT #581

Closed
willzhang opened this issue Oct 18, 2023 · 3 comments
Closed

Invalid value SASL_PLAINTEXT #581

willzhang opened this issue Oct 18, 2023 · 3 comments
Labels

Comments

@willzhang
Copy link

willzhang commented Oct 18, 2023

install bitnami kafka

helm install kafka bitnami/kafka \
  -n kafka --create-namespace \
  --set sasl.client.passwords="password1"

install kafdrop

export KAFKA_PROPERTIES=$(echo "security.protocol=SASL_PLAINTEXT\nsasl.mechanism=SCRAM-SHA-256\nsasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user1\" password=\"password1\";" | base64)
helm upgrade -i kafdrop ./charts/kafdrop/ -n kafdrop --set kafka.brokerConnect=kafka.kafka:9092 \
  --set kafka.properties="${KAFKA_PROPERTIES}"

error logs

$ kubectl -n kafdrop get pods
NAME                       READY   STATUS             RESTARTS      AGE
kafdrop-5f54456879-cwrpl   0/1     CrashLoopBackOff   3 (36s ago)   97s

$ kubectl -n kafdrop logs -f kafdrop-5f54456879-cwrpl 

:::    :::     :::     :::::::::: :::::::::  :::::::::   ::::::::  :::::::::           :::    
:+:   :+:    :+: :+:   :+:        :+:    :+: :+:    :+: :+:    :+: :+:    :+:         :+:     
+:+  +:+    +:+   +:+  +:+        +:+    +:+ +:+    +:+ +:+    +:+ +:+    +:+        +:+ +:+  
+#++:++    +#++:++#++: :#::+::#   +#+    +:+ +#++:++#:  +#+    +:+ +#++:++#+        +#+  +:+  
+#+  +#+   +#+     +#+ +#+        +#+    +#+ +#+    +#+ +#+    +#+ +#+             +#+#+#+#+#+
#+#   #+#  #+#     #+# #+#        #+#    #+# #+#    #+# #+#    #+# #+#                   #+#  
###    ### ###     ### ###        #########  ###    ###  ########  ###                   ###  

Writing Kafka properties into kafka.properties
2023-10-18 03:11:40.842  INFO ${sys:PID} [           main] k.Kafdrop$EnvironmentSetupListener       : Initializing JAAS config
2023-10-18 03:11:40.850  INFO ${sys:PID} [           main] k.Kafdrop$EnvironmentSetupListener       : Env: null
2023-10-18 03:11:40.937  INFO 1 [kground-preinit] o.h.v.i.u.Version                        : HV000001: Hibernate Validator 8.0.1.Final
2023-10-18 03:11:40.977  INFO 1 [           main] o.s.b.StartupInfoLogger                  : Starting Kafdrop v4.0.0 using Java 17.0.8.1 with PID 1 (/kafdrop-4.0.0/kafdrop-4.0.0.jar started by root in /)
2023-10-18 03:11:40.981  INFO 1 [           main] o.s.b.SpringApplication                  : No active profile set, falling back to 1 default profile: "default"
2023-10-18 03:11:43.099  INFO 1 [           main] i.u.s.s.ServletContextImpl               : Initializing Spring embedded WebApplicationContext
2023-10-18 03:11:43.102  INFO 1 [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2071 ms
2023-10-18 03:11:43.353  INFO 1 [           main] k.c.KafkaConfiguration                   : Checking truststore file kafka.truststore.jks
2023-10-18 03:11:43.353  INFO 1 [           main] k.c.KafkaConfiguration                   : Assigning truststore location to kafka.truststore.jks
2023-10-18 03:11:43.353  INFO 1 [           main] k.c.KafkaConfiguration                   : Checking keystore file kafka.keystore.jks
2023-10-18 03:11:43.354  INFO 1 [           main] k.c.KafkaConfiguration                   : Assigning keystore location to kafka.keystore.jks
2023-10-18 03:11:43.354  INFO 1 [           main] k.c.KafkaConfiguration                   : Checking properties file kafka.properties
2023-10-18 03:11:43.354  INFO 1 [           main] k.c.KafkaConfiguration                   : Loading properties from kafka.properties
2023-10-18 03:11:43.374  WARN 1 [           main] o.s.c.s.AbstractApplicationContext       : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaHighLevelConsumer': Invocation of init method failed
2023-10-18 03:11:43.393  INFO 1 [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-10-18 03:11:43.412 ERROR 1 [           main] o.s.b.SpringApplication                  : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaHighLevelConsumer': Invocation of init method failed
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150)
        at kafdrop.Kafdrop.main(Kafdrop.java:60)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:95)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: org.apache.kafka.common.config.ConfigException: Invalid value SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user1" password="password1"; for configuration security.protocol: String must be one of: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL
        at org.apache.kafka.common.config.ConfigDef$ValidString.ensureValid(ConfigDef.java:961)
        at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:499)
        at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:483)
        at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:112)
        at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:132)
        at org.apache.kafka.clients.consumer.ConsumerConfig.<init>(ConsumerConfig.java:652)
        at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:665)
        at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:646)
        at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:626)
        at kafdrop.service.KafkaHighLevelConsumer.initializeClient(KafkaHighLevelConsumer.java:67)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMethod.invoke(InitDestroyAnnotationBeanPostProcessor.java:457)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:401)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:219)
        ... 25 more

@mehdihasan
Copy link
Contributor

mehdihasan commented Nov 6, 2023

Hi @willzhang ,

I tried the following and everything works fine for me.

helm repo add bitnami https://charts.bitnami.com/bitnami

helm fetch bitnami/kafka 

helm install kafka bitnami/kafka \
  -n kafka --create-namespace \
  --set sasl.client.passwords="password1"

export KAFKA_PROPERTIES=$(echo "security.protocol=SASL_PLAINTEXT\nsasl.mechanism=SCRAM-SHA-256\nsasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user1\" password=\"password1\";" | base64)
helm upgrade -i kafdrop ./chart -n kafdrop --set kafka.brokerConnect=kafka.kafka:9092 \
  --set kafka.properties="${KAFKA_PROPERTIES}"

Also, I think the issue is not related to any code or configuration with Kafdrop instead something environment specific.

Copy link

github-actions bot commented Dec 7, 2023

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 7, 2023
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants