Preview functionality. This is a preview feature and is subject to change. The existing listener configuration remains fully supported.
- Expose internal and external endpoints (for example, PLAINTEXT for internal services, SASL_SSL for external clients)
- Support Kubernetes deployments with separate ClusterIP and LoadBalancer services
- Serve different client populations with different security requirements
Understand configuration modes
Gateway detects the configuration mode automatically at startup based on the environment variables you set:| Mode | Trigger | Use case |
|---|---|---|
| Multi-listener | Any GATEWAY_LISTENER_* env var is set | Multiple listeners, advanced configuration |
| Standard | Standard env vars like GATEWAY_PORT_START | Single listener deployments |
| Zero-config | No listener configuration | Local development and testing only |
Standard mode will be deprecated once the multi-listener feature is stabilized. Multi-listener mode will become the new standard for all deployments.
Zero-config mode
If you don’t set any listener or networking environment variables, Gateway configures itself automatically. It creates a single listener with port routing. Ports start from6969, with one port per broker plus two extra for headroom.
The listener uses the same security protocol as the backing Kafka cluster. If you don’t set GATEWAY_SECURITY_MODE, Gateway infers the security mode from the protocol: KAFKA_MANAGED for SASL protocols, GATEWAY_MANAGED for others.
Configure listeners
Define each listener using environment variables with the patternGATEWAY_LISTENER_<NAME>_<PROPERTY>, where <NAME> is a label you choose (for example, EXTERNAL, INTERNAL).
| Variable | Description | Default |
|---|---|---|
GATEWAY_LISTENER_<NAME>_SECURITY_PROTOCOL | Security protocol: PLAINTEXT, SSL, SASL_SSL, or SASL_PLAINTEXT | Required |
GATEWAY_LISTENER_<NAME>_ROUTING | Routing mechanism: port or sni | Required |
GATEWAY_LISTENER_<NAME>_PORTS | Port specification (comma-separated for multiple ranges) | Required |
GATEWAY_LISTENER_<NAME>_BIND_ADDRESS | Network interface to bind to | 0.0.0.0 |
GATEWAY_LISTENER_<NAME>_ADVERTISED_HOST | Hostname returned to clients | System hostname or localhost |
GATEWAY_LISTENER_<NAME>_ADVERTISED_HOST_PATTERN | Template for per-broker hostnames. Only used when routing is set to sni. | broker-{{physicalCluster}}-{{nodeId}}.{{advertisedHost}} |
GATEWAY_LISTENER_<NAME>_BOOTSTRAP_HOST_PATTERN | Template for bootstrap hostname. Only used when routing is set to sni. | Derived from ADVERTISED_HOST_PATTERN, or bootstrap-{{physicalCluster}}.{{advertisedHost}} if not set |
Listener names have to start with a letter and contain only alphanumeric characters. Don’t use underscores or special characters — a name like
MY_LISTENER would be ambiguous since underscores are already used as delimiters in GATEWAY_LISTENER_<NAME>_<PROPERTY>.Specify ports
The format ofGATEWAY_LISTENER_<NAME>_PORTS depends on the routing mechanism.
Port routing
Gateway assigns one port per broker, in order, starting from broker IDGATEWAY_MIN_BROKERID. Make sure to define enough ports to cover all your brokers.
Ports can be defined as ranges, individual values, or a combination of both, separated by commas:
advertised:local format:
GATEWAY_MIN_BROKERID=0 and three brokers:
SNI routing
With SNI routing, Gateway listens on a single port and routes traffic based on the hostname in the TLS handshake. SNI routing requires a TLS-based security protocol (SSL or SASL_SSL) and proper DNS and TLS certificates for each broker hostname.
advertised:local format:
Configure host patterns
With SNI routing, each broker needs a unique hostname so clients can reach it. SetGATEWAY_LISTENER_<NAME>_ADVERTISED_HOST_PATTERN using these template variables:
| Template | Description | Example value |
|---|---|---|
{{nodeId}} | Broker ID | 0, 1, 2 |
{{physicalCluster}} | Backend cluster name | main |
{{virtualCluster}} | Virtual cluster name | my-partner |
{{advertisedHost}} | Listener’s advertised host | gateway.example.com |
broker-{{physicalCluster}}-{{nodeId}}.{{advertisedHost}}.
Clients also need a bootstrap hostname for the initial connection before broker discovery. You can set it with GATEWAY_LISTENER_<NAME>_BOOTSTRAP_HOST_PATTERN,
or let Gateway derive it automatically from the advertised host pattern by removing the {{nodeId}} part and its adjacent separator (., -, or _).
When the advertised host pattern is also not set, the default bootstrap pattern is bootstrap-{{physicalCluster}}.{{advertisedHost}}.
Your TLS certificates and DNS records have to cover both the broker and bootstrap hostnames.
Choose a routing strategy
| Setup | Recommended | Why |
|---|---|---|
| Single cluster, dev/test | Port | Simple, no DNS or certificates required |
| Single cluster, production | Port or SNI | Both work well; SNI simplifies port management |
| Multi-cluster, dev/test | Port | Acceptable for ephemeral environments |
| Multi-cluster, production | SNI | Port mapping shifts when clusters change |
Current limitations
- Shared SSL configuration: All listeners share the same SSL configuration. To serve different certificates per listener, include all of them in the global keystore — Gateway selects the right one based on SNI during the TLS handshake.
- Shared SASL mechanisms: All SASL listeners share the same set of enabled SASL mechanisms. You can’t enable different mechanisms per listener (for example, OAUTHBEARER-only for external, PLAIN-only for internal).
- Global security mode: All listeners share the same
GATEWAY_SECURITY_MODE. You can’t mixGATEWAY_MANAGEDandKAFKA_MANAGEDacross listeners. If your use case requires both modes, deploy separate Gateway instances. - Internal load balancing: Internal load balancing is a global setting, not per listener. When enabled, all listeners have to share the same advertised host. If listeners have different advertised hosts, disable internal load balancing or Gateway will fail to start.
Examples
These examples show listener configuration only. You also need to set
KAFKA_BOOTSTRAP_SERVERS and other Kafka connection variables for Gateway to connect to your cluster. See Gateway environment variables for the full reference.- Port routing
- SNI routing
- Multiple listeners
A single listener using port routing, suitable for local development or simple deployments:
Verify your configuration
Check the Gateway startup logs to confirm your listeners are configured correctly. Gateway logs the computed configuration at startup, including all registered listeners, their ports and routing mechanisms. To make sure the values were set correctly, check the startup logs:Computed configuration output. Each listener should appear with its name, ports, security protocol and routing mechanism.
If a listener is missing or has unexpected values, verify that the environment variables follow the GATEWAY_LISTENER_<NAME>_<PROPERTY> naming pattern and that the listener name contains only alphanumeric characters.
Switch from standard configuration
If you’re currently using standard environment variables and want to adopt the multi-listener configuration, use this mapping as a reference. Standard variables internally create a single listener named DEFAULT.| Standard variable | Multi-listener equivalent |
|---|---|
GATEWAY_BIND_HOST | GATEWAY_LISTENER_<NAME>_BIND_ADDRESS |
GATEWAY_ADVERTISED_HOST | GATEWAY_LISTENER_<NAME>_ADVERTISED_HOST |
GATEWAY_PORT_START and GATEWAY_PORT_COUNT | GATEWAY_LISTENER_<NAME>_PORTS |
GATEWAY_ADVERTISED_SNI_PORT | GATEWAY_LISTENER_<NAME>_PORTS (use advertised:local format) |
GATEWAY_ROUTING_MECHANISM | GATEWAY_LISTENER_<NAME>_ROUTING (host is now called sni) |
GATEWAY_SECURITY_PROTOCOL | GATEWAY_LISTENER_<NAME>_SECURITY_PROTOCOL |
GATEWAY_ADVERTISED_HOST_PREFIX and GATEWAY_SNI_HOST_SEPARATOR | GATEWAY_LISTENER_<NAME>_ADVERTISED_HOST_PATTERN and GATEWAY_LISTENER_<NAME>_BOOTSTRAP_HOST_PATTERN |
GATEWAY_PORT_START=6969 with GATEWAY_PORT_COUNT=5 maps to the port range 6969-6973.
The :443 suffix replaces GATEWAY_ADVERTISED_SNI_PORT=443, meaning Gateway listens locally on ports 6969-6973 but advertises port 443 to clients.
GATEWAY_ADVERTISED_HOST_PREFIX and GATEWAY_SNI_HOST_SEPARATOR are replaced by explicit host patterns using template variables.
When switching, keep in mind:
- Set the security mode explicitly:
GATEWAY_SECURITY_MODEis required in multi-listener mode and is not automatically inferred. - SNI host patterns have changed: The default advertised host pattern is now
broker-{{physicalCluster}}-{{nodeId}}.{{advertisedHost}}, which differs from the previous behavior based onGATEWAY_ADVERTISED_HOST_PREFIX(default:broker) andGATEWAY_SNI_HOST_SEPARATOR(default:-). If your DNS records and TLS certificates match the old pattern, either update them or set the pattern explicitly to match. For example, to reproduce the previous default behavior: - mTLS users: Set
GATEWAY_SSL_CLIENT_AUTHexplicitly (it is no longer auto-inferred).