Before you begin
- Upgrade to StreamNative Operator Helm chart 0.20.6 (Operator v0.20.18) and update its CRDs. This release preserves
clientAuthwhen server authentication is configured throughcustominstead of the typedauthenticationfield. See Upgrade StreamNative Operator. - Prepare a CA, a server certificate and private key, and a separate client certificate and private key for the broker’s internal client.
- Check that the CA, server certificate, and client certificates are within their validity periods. Renew expired certificates and update their Secrets before testing connections.
- Include the Service and advertised broker DNS names in the server certificate’s subject alternative names (SANs). Include
serverAuthusage on the server certificate andclientAuthusage on client certificates. - Choose the client certificate common names and grant their corresponding roles the required permissions.
Create certificate Secrets
Create two Secrets in the broker’s namespace. Each Secret containstls.crt, tls.key, and ca.crt. Supply the leaf certificate and any required intermediate certificates in tls.crt.
broker-admin. Give each application its own client certificate and role. Distribute the trusted CA, not its signing private key, to components and applications.
Configure the server and its internal client
Merge these settings into yourPulsarBroker:
Configure
spec.tls before, or in the same update as, enabling clientAuth.mtls or custom broker-client TLS properties. Client-side TLS settings alone do not create server TLS endpoints.
The Operator mounts server material under /etc/tls/pulsar-broker and client material under /mnt/client/mtls. The typed client configuration generates:
PULSAR_PREFIX_ form of these keys. A mounted certificate Secret alone does not prove that the internal client’s authentication properties were generated correctly.
If you configure server authentication through spec.config.custom, you can omit the typed authentication field and retain typed clientAuth.mtls on Operator 0.20.16. Custom authentication properties take precedence over typed values. See Authentication overview.
For a proxy or Functions Worker, clientAuth.mtls configures its connection to brokers. Configure the TLS broker endpoint and the certificate role’s permissions for that component. Do not assume that enabling TLS on the component’s own server also changes its broker connection URL.
Connect a client
Use the actual TLS endpoints. The default broker ports are 6651 forpulsar+ssl:// and 8443 for HTTPS. Operator-generated non-TLS brokerServiceUrl and webServiceUrl values must not be reused as TLS client URLs.
With the default cluster_tls listener, produce messages as follows:
consume persistent://<tenant>/<namespace>/mtls-check -s mtls-check -n 3. Use the listener name configured by your deployment if it differs from cluster_tls.
For a Java application, enable CA and hostname verification:
PulsarClient and AuthenticationFactory from org.apache.pulsar.client.api, and close the client when the application exits.
Check an administrative HTTPS endpoint with the client certificate:
Verify authentication and internal operations
Check all of the following after the broker becomes Ready:
For example, use an administrative
pulsar-admin client with HTTPS, CA, and TLS authentication settings to set and retrieve a policy on an existing test topic:
topics get-retention persistent://<tenant>/<namespace>/mtls-check to confirm the value. This example retains messages for 10 minutes without a size limit. If you set a size limit, make it larger than the namespace’s backlog quota. A lower retention limit can cause HTTP 412.
If Pods are Ready but topic policies fail, inspect broker logs and generated client properties. Enabling TLS while connecting to pulsar://...:6650 can cause handshake failures; depending on the client path, a configuration error can also appear. Verify the URL scheme, port, listener, CA, hostname, and internal client role together.