Skip to content

Kafka-UI does not correctly support configuring clusters via environment variables (binding failures) #1045

Closed
@Heniland

Description

@Heniland

Issue submitter TODO list

  • I've looked up my issue in FAQ
  • I've searched for an already existing issues here
  • I've tried running main-labeled docker image and the issue still persists there
  • I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

Kafka-UI does not correctly support configuring clusters purely through environment variables.
When providing cluster connection information (name, bootstrapServers, security.protocol, sasl.jaas.config, etc.) via environment variables, the application fails to start due to Spring Boot binding errors.

This severely limits the ability to use Kafka-UI in cloud-native deployments where secrets and configs are dynamically injected.

Expected behavior

Kafka-UI should fully support defining clusters via environment variables, matching the documented environment variable naming conventions.

It should allow overriding individual cluster fields (such as sasl.jaas.config) via environment variables, merging them cleanly with any static configuration provided.

Your installation details

installed with helm version 1.4.11

kafka:
      clusters:
        - name: "kafka-prod"
          bootstrapServers: "boot-...amazonaws.com:9092"
        - name: "kafka-dev"
          bootstrapServers: "b-1....amazonaws.com:9092"
        - name: "kafka-dev-hanoch-test"
          bootstrapServers: "b-1...:9096"
          properties:
            security.protocol: "SASL_SSL"
            sasl.mechanism: "SCRAM-SHA-512"
            sasl.jaas.config: >
            org.apache.kafka.common.security.scram.ScramLoginModule required username="username" password="password";
        - name: "kafka-dev-hanoch-test-unauthenticated"
          bootstrapServers: "b-1...amazonaws.com:9092"
    auth:
      type: OAUTH2
      oauth2:
        client:
          azure:
            scope: openid
            client-name: azure
            provider: azure
            redirect-uri: "https://..."
            issuer-uri: "https://login.../v2.0"
            jwk-set-uri: "https://.../discovery/v2.0/keys"
    management:
      health:
        ldap:
          enabled: false
  • All the above static configration is working. the problem is only when i pass ENV values

Steps to reproduce

  1. Deploy Kafka-UI with only environment variables or a mix (static + environment overrides).
  2. Set environment variables according to documentation.
  3. Start the application.
  4. Observe binding failure and application crash.

I used [AWS Secrets Manager] -> [ExternalSecret] -> [Kafka-UI Pod] (This step works, I added it here for completeness)

NOTE: I used ENV like "KAFKA_CLUSTERS_4_" because i already have a static configuration and they all are working. the motivation for ENV is to pass the password from ExternalSecret.

Screenshots

No response

Logs

 _   _ ___    __             _                _          _  __      __ _
| | | |_ _|  / _|___ _ _    /_\  _ __ __ _ __| |_  ___  | |/ /__ _ / _| |_____
| |_| || |  |  _/ _ | '_|  / _ \| '_ / _` / _| ' \/ -_) | ' </ _` |  _| / / _`|
 \___/|___| |_| \___|_|   /_/ \_| .__\__,_\__|_||_\___| |_|\_\__,_|_| |_\_\__,|
                                 |_|
2025-04-28 12:45:47,974 INFO  [main] i.k.u.KafkaUiApplication: Starting KafkaUiApplication v371be00 using Java 21.0.6 with PID 1 (/api.jar started by kafkaui in /)
2025-04-28 12:45:48,004 DEBUG [main] i.k.u.KafkaUiApplication: Running with Spring Boot v3.4.4, Spring v6.2.5
2025-04-28 12:45:48,005 INFO  [main] i.k.u.KafkaUiApplication: No active profile set, falling back to 1 default profile: "default"
2025-04-28 12:45:53,609 WARN  [main] o.s.b.w.r.c.AnnotationConfigReactiveWebServerApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'clustersProperties': Could not bind properties to 'ClustersProperties' : prefix=kafka, ignoreInvalidFields=false, ignoreUnknownFields=true
2025-04-28 12:45:53,641 INFO  [main] o.s.b.a.l.ConditionEvaluationReportLogger:
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-04-28 12:45:53,725 ERROR [main] o.s.b.d.LoggingFailureAnalysisReporter:
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@7433ca19 type = java.util.List<io.kafbat.ui.config.ClustersProperties$Cluster>, value = 'provided', annotations = array<Annotation>[[empty]], bindMethod = [null]] failed:
    Property: kafka.clusters[4].bootstrapservers
    Value: "b-1...amazonaws.com:9096"
    Origin: System Environment Property "KAFKA_CLUSTERS_4_BOOTSTRAPSERVERS"
    Reason: The elements [kafka.clusters[4].bootstrapservers,kafka.clusters[4].name,kafka.clusters[4].properties.sasl.jaas.config,kafka.clusters[4].properties.sasl.mechanism,kafka.clusters[4].properties.security.protocol] were left unbound.
    Property: kafka.clusters[4].name
    Value: "kafka-dev-hanoch-as"
    Origin: System Environment Property "KAFKA_CLUSTERS_4_NAME"
    Reason: The elements [kafka.clusters[4].bootstrapservers,kafka.clusters[4].name,kafka.clusters[4].properties.sasl.jaas.config,kafka.clusters[4].properties.sasl.mechanism,kafka.clusters[4].properties.security.protocol] were left unbound.
    Property: kafka.clusters[4].properties.sasl.jaas.config
    Value: "'org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"admin-secret\";'"
    Origin: System Environment Property "KAFKA_CLUSTERS_4_PROPERTIES_SASL_JAAS_CONFIG"
    Reason: The elements [kafka.clusters[4].bootstrapservers,kafka.clusters[4].name,kafka.clusters[4].properties.sasl.jaas.config,kafka.clusters[4].properties.sasl.mechanism,kafka.clusters[4].properties.security.protocol] were left unbound.
    Property: kafka.clusters[4].properties.sasl.mechanism
    Value: "PLAIN"
    Origin: System Environment Property "KAFKA_CLUSTERS_4_PROPERTIES_SASL_MECHANISM"
    Reason: The elements [kafka.clusters[4].bootstrapservers,kafka.clusters[4].name,kafka.clusters[4].properties.sasl.jaas.config,kafka.clusters[4].properties.sasl.mechanism,kafka.clusters[4].properties.security.protocol] were left unbound.
    Property: kafka.clusters[4].properties.security.protocol
    Value: "SASL_PLAINTEXT"
    Origin: System Environment Property "KAFKA_CLUSTERS_4_PROPERTIES_SECURITY_PROTOCOL"
    Reason: The elements [kafka.clusters[4].bootstrapservers,kafka.clusters[4].name,kafka.clusters[4].properties.sasl.jaas.config,kafka.clusters[4].properties.sasl.mechanism,kafka.clusters[4].properties.security.protocol] were left unbound.
Action:
Update your application's configuration

Additional context

Spring Boot v3.4.4
Spring v6.2.5

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions