此内容没有您所选择的语言版本。
Chapter 13. GenericKafkaListenerConfiguration schema reference
Used in: GenericKafkaListener
Full list of GenericKafkaListenerConfiguration schema properties
Configures Kafka listeners.
13.1. Providing your own listener certificates 复制链接链接已复制到粘贴板!
The brokerCertChainAndKey property is for listeners that have TLS encryption enabled only. Use this property to provide your own Kafka listener certificates.
Example loadbalancer listener configuration to provide certificates
When the certificate or key in the brokerCertChainAndKey secret is updated, the operator automatically detects it in the next reconciliation and triggers a rolling update of the Kafka brokers to reload the certificate.
13.2. Avoiding hops to other nodes 复制链接链接已复制到粘贴板!
The externalTrafficPolicy property is used with loadbalancer and nodeport listeners. When exposing Kafka outside of OpenShift, you can choose Local or Cluster. Local avoids hops to other nodes and preserves the client IP, whereas Cluster does neither. The default is Cluster.
Example loadbalancer listener configuration avoiding hops
13.3. Providing CIDR source ranges for a loadbalancer 复制链接链接已复制到粘贴板!
The loadBalancerSourceRanges property is for loadbalancer listeners only. When exposing Kafka outside of OpenShift, use CIDR (Classless Inter-Domain Routing) source ranges in addition to labels and annotations to customize how a service is created.
Example loadbalancer listener configuration to provide source ranges
13.4. Specifying a preferred node port address type 复制链接链接已复制到粘贴板!
The preferredNodePortAddressType property is for nodeport listeners only. Use this property in your listener configuration to specify the first address type checked as the node address. This property is useful, for example, if your deployment does not have DNS support or you only want to expose a broker internally through an internal DNS or IP address.
If an address of this type is found, it is used. If the preferred address type is not found, Streams for Apache Kafka proceeds through the types in the standard order of priority:
- ExternalDNS
- ExternalIP
- Hostname
- InternalDNS
- InternalIP
Example nodeport listener using a preferred node port address type
13.5. Using fully-qualified DNS names 复制链接链接已复制到粘贴板!
The useServiceDnsDomain property is for internal and cluster-ip listeners. It defines whether the fully-qualified DNS names that include the cluster service suffix (usually .cluster.local) are used.
-
Set to
false(default) to generate advertised addresses without the service suffix; for example,my-cluster-kafka-0.my-cluster-kafka-brokers.myproject.svc. -
Set to
trueto generate advertised addresses with the service suffix; for example,my-cluster-kafka-0.my-cluster-kafka-brokers.myproject.svc.cluster.local.
Example internal listener using the service DNS domain
13.6. Specifying the hostname 复制链接链接已复制到粘贴板!
To specify the hostname used for the bootstrap resource or brokers, use the host property. The host property is for route and ingress listeners only.
A host property value is mandatory for ingress listener configuration, as the Ingress controller does not assign any hostnames automatically. Make sure that the hostname resolves to the Ingress endpoints. Streams for Apache Kafka will not perform any validation to ensure that the requested hosts are available and properly routed to the Ingress endpoints.
Example ingress listener with host configuration
By default, route listener hosts are automatically assigned by OpenShift. However, you can override the assigned route hosts by specifying hosts.
Streams for Apache Kafka does not perform any validation to ensure that the requested hosts are available. You must ensure that they are free and can be used.
Example route listener with host configuration
Instead of specifying the host property for every broker, you can also use a hostTemplate to generate them automatically. The hostTemplate supports the following variables:
-
The
{nodeId}variable is replaced with the ID of the Kafka node to which the template is applied. -
The
{nodePodName}variable is replaced with the OpenShift pod name for the Kafka node where the template is applied.
The hostTemplate property applies only to per-broker values. The bootstrap host property must always be specified.
Example ingress listener with hostTemplate configuration
13.7. Overriding assigned node ports 复制链接链接已复制到粘贴板!
By default, the port numbers used for the bootstrap and broker services are automatically assigned by OpenShift. You can override the assigned node ports for nodeport listeners by specifying the desired port numbers.
Streams for Apache Kafka does not perform any validation on the requested ports. You must ensure that they are free and available for use.
Example nodeport listener configuration with overrides for node ports
13.8. Requesting a specific loadbalancer IP address 复制链接链接已复制到粘贴板!
Use the loadBalancerIP property to request a specific IP address when creating a loadbalancer. This property is useful when you need to use a loadbalancer with a specific IP address. The loadBalancerIP property is ignored if the cloud provider does not support this feature.
Example loadbalancer listener with specific IP addresses
13.9. Adding listener annotations to OpenShift resources 复制链接链接已复制到粘贴板!
Use the annotations property to add annotations to OpenShift resources related to the listeners. These annotations can be used, for example, to instrument DNS tooling such as External DNS, which automatically assigns DNS names to the loadbalancer services.
Example loadbalancer listener using annotations
| Property | Property type | Description |
|---|---|---|
| brokerCertChainAndKey |
Reference to the | |
| class | string |
Configures a specific class for
For |
| externalTrafficPolicy | string (one of [Local, Cluster]) | Specifies whether the service routes external traffic to cluster-wide or node-local endpoints:
If unspecified, OpenShift uses |
| loadBalancerSourceRanges | string array |
A list of CIDR ranges (for example |
| bootstrap | Bootstrap configuration. | |
| brokers | Per-broker configurations. | |
| ipFamilyPolicy | string (one of [RequireDualStack, SingleStack, PreferDualStack]) |
Specifies the IP Family Policy used by the service. Available options are
If unspecified, OpenShift will choose the default value based on the service type. |
| ipFamilies | string (one or more of [IPv6, IPv4]) array |
Specifies the IP Families used by the service. Available options are |
| createBootstrapService | boolean |
Whether to create the bootstrap service or not. The bootstrap service is created by default (if not specified differently). This field can be used with the |
| finalizers | string array |
A list of finalizers configured for the |
| useServiceDnsDomain | boolean | Configures whether the OpenShift service DNS domain should be included in the generated addresses.
The default is |
| maxConnections | integer | The maximum number of connections we allow for this listener in the broker at any time. New connections are blocked if the limit is reached. |
| maxConnectionCreationRate | integer | The maximum connection creation rate we allow in this listener at any time. New connections will be throttled if the limit is reached. |
| preferredNodePortAddressType | string (one of [ExternalDNS, ExternalIP, Hostname, InternalIP, InternalDNS]) |
Defines which address type should be used as the node address. Available types are:
This property is used to select the preferred address type, which is checked first. If no address is found for this address type, the other types are checked in the default order.For |
| publishNotReadyAddresses | boolean |
Configures whether the service endpoints are considered "ready" even if the Pods themselves are not. Defaults to |
| hostTemplate | string |
Configures the template for generating the hostnames of the individual brokers. Valid placeholders that you can use in the template are |
| advertisedHostTemplate | string |
Configures the template for generating the advertised hostnames of the individual brokers. Valid placeholders that you can use in the template are |
| allocateLoadBalancerNodePorts | boolean |
Configures whether to allocate NodePort automatically for the |