Listener configuration options
Additional and advanced Kafka listener configuration options for Cloudera Streams Messaging Operator for Kubernetes beyond the default type and port settings.
Per-listener Kafka configuration
Some Kafka options can be configured per listener rather than only at the broker level using
spec.kafka.config. This enables more granular control. For example, you can
enforce connection limits or session re-authentication on a specific external listener without
affecting internal listeners.
Depending on the option, per-listener configuration uses one of the following mechanisms:
- Dedicated fields in the listener
configuration -
The following options are typed fields in the
configurationsection of each listener:maxConnections– Maximum number of connections allowed for this listener at any time. New connections are blocked if the limit is reached.maxConnectionCreationRate– Maximum connection creation rate for this listener. New connections are throttled if the limit is reached.
#... kind: Kafka spec: kafka: listeners: - name: external port: 9094 type: loadbalancer tls: true configuration: maxConnections: 1000 maxConnectionCreationRate: 100 - Listener-prefixed properties in
spec.kafka.config -
The following options can be scoped to a specific listener by adding the
listener.name.[***LISTENER NAME***]-[***PORT***].prefix inspec.kafka.config. The listener name and port in the prefix must match thenameandportvalues of the listener in your Kafka resource, joined with a hyphen:connections.max.reauth.msmax.connectionsmax.connections.per.ipmax.connections.per.ip.overridesmax.connection.creation.rate
#... kind: Kafka spec: kafka: config: listener.name.external-9094.connections.max.reauth.ms: 3600000 listener.name.external-9094.max.connections.per.ip: 500In this example, the listener is named
externaland runs on port9094, so the prefix islistener.name.external-9094..
Advertised port template
The advertisedPortTemplate field in the listener
configuration controls how Strimzi generates the advertised ports for
individual brokers. This is useful for external listener types such as
nodeport and loadbalancer, where clients connect
directly to specific brokers and need predictable per-broker port numbers.
The template supports a simple mathematical expression using the {nodeId}
placeholder and the +, -, and * operators.
Strimzi substitutes the broker node ID into the expression to calculate the advertised port for
each broker. You can also specify a fixed port number to use the same port for all brokers.
#...
kind: Kafka
spec:
kafka:
listeners:
- name: external
port: 9094
type: nodeport
tls: true
configuration:
advertisedPortTemplate: 9000 + {nodeId}
In this example, brokers are advertised on ports 9000, 9001, 9002, and so on, based on their node ID.
