NodePort
Learn about Kubernetes NodePorts and how CSM Operator uses NodePorts to provide Kafka clients access to your cluster.
NodePort is a Kubernetes Service type that allocates a port, referred to as a node port, on every node of the Kubernetes cluster. NodePort ensures that all traffic routed to the node port gets to a specific pod.
In CSM Operator, you set up external cluster access with NodePorts by adding
nodeport
type listeners to your Kafka resource
(listener.type:nodeport
).
- One NodePort that serves as an external bootstrap. This is used by clients for the initial connection and to receive metadata (advertised listeners) from the Kafka cluster.
- A NodePort for each Kafka broker. These are used by clients to directly access the individual brokers.
The addresses of the nodes and the node ports are collected by CSM Operator and configured as the advertised listeners of the brokers. So brokers are automatically configured to advertise the right address and ports. As a result, once listener setup is complete, you can connect your clients running outside of the Kubernetes network by directing them to the NodePort Service that acts as the external bootstrap. Kubernetes handles everything else and ensures that client requests are routed to the correct brokers.
Configuring nodeport listeners
Complete the following steps to set up and configure a nodeport type listener in CSM Operator. The following steps also include an example on how to connect a Kafka console client to the cluster.
These steps demonstrate basic listener configuration with typical customizations. In
addition to the configuration shown here, you can further customize your listener
and enable or disable TLS encryption using the tls
property,
specify a client authentication mechanism with the authentication
property, as well as add various additional configurations using the
configuration
property. For a comprehensive list of available
properties, see the GenericKafkaListener schema reference in the
Strimzi API reference.
nodeport
type listener is configured. External Kafka clients can
now access your Kafka cluster through the NodePort Services.