Skip to content

Incorrect/misleading Documentation for receiver/kafkametrics TLS Configuration #37776

Closed
@enrico-agile

Description

@enrico-agile

Component(s)

receiver/kafkametrics

Describe the issue you're reporting

Today I was trying to configure the kafkametrics receiver to monitor a cluster that is using TLS w/ plain_text authentication.
In the end I've managed to make it work but I've admittedly lost a lot of time trying to configure it.

The documentation currently states:

  • auth.tls.ca_file: path to the CA cert. For a client this verifies the server certificate. Should only be used if insecure is set to true
  • auth.tls.insecure: (default = false) Disable verifying the server's certificate chain and host name (InsecureSkipVerify in the tls config)

However, after reviewing the code (here and here), I found discrepancies:

  • insecure: Does not disable certificate verification, it actually disables TLS entirely
  • ca_file: The statement Should only be used if insecure is set to true is misleading - In reality, configuring a ca_file implicitly neutralizes an insecure=true, enabling TLS even if insecure is set to false
  • insecure_skip_verify: This is the actual parameter that disables certificate verification, but it is undocumented

Additionally, the way the configuration is structured is a little confusing. There are valid Kafka configurations with plain_text authentication (like my case) or even Kerberos authentication that require TLS encryption. The only way to enable TLS in these scenarios is to pass a non-nil auth.tls configuration, as shown in my example configuration below, even if I'm not actually using mTLS authn.

The following configuration successfully enabled monitoring in my setup:

receivers:
  kafkametrics:
    brokers:
      - broker0:9092
      - broker1:9092
      - broker3:9093
    protocol_version: 2.0.0
    scrapers:
      - brokers
      - topics
      - consumers
    auth:
      plain_text:
        username: username
        password: password
      tls:
        insecure: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions