Secure Client Connections with TLS
Use TLS when producers, consumers, automation, or administrators connect to RabbitMQ over an untrusted network, through an external NodePort or LoadBalancer, or across clusters. TLS protects AMQP traffic and the management HTTP API from clear-text transmission.
This guide covers RabbitMQ listener TLS for client access. It does not replace user, virtual host, or permission controls. Configure both TLS and least-privilege RabbitMQ users for production workloads.
TOC
PrerequisitesProcedure1. Create TLS secrets2. Configure the RabbitmqCluster3. Wait for the rollout4. Verify TLS listeners5. Connect with TLSVerificationTroubleshootingRelated InformationPrerequisites
Before you enable TLS, make sure that the following conditions are met:
- You have a
RabbitmqClusterinstance. - You have a server certificate and private key for the RabbitMQ access names that clients use.
- The certificate Subject Alternative Name includes the in-cluster service DNS names and any external DNS names or IP addresses used by clients.
- If clients must verify a private CA, you have the CA certificate.
- Applications are prepared to use
amqps://and the TLS management endpoint after non-TLS listeners are disabled.
Setting spec.tls.disableNonTLSListeners to true disables non-TLS listeners for RabbitMQ, the management plugin, and supported protocol plugins. Enable this only after all clients and operational tools can use TLS endpoints.
Procedure
1. Create TLS secrets
Create a TLS secret in the same namespace as the RabbitmqCluster:
If clients use a private CA, create a CA secret:
2. Configure the RabbitmqCluster
Update the RabbitmqCluster to reference the TLS secret. Include caSecretName when the broker must trust a private CA for mutual TLS or for relevant protocol plugins such as web_stomp and web_mqtt. External AMQP or management clients still need the CA certificate in their own trust store.
If you are migrating existing clients, keep disableNonTLSListeners unset or set it to false during the migration window. After all clients use TLS, update the field to true.
3. Wait for the rollout
Wait until the instance returns to the active phase and all RabbitMQ Pods are ready:
4. Verify TLS listeners
Check the listener list from a RabbitMQ Pod:
For a TLS-only configuration, the output should include TLS listeners and should no longer show plain AMQP or plain HTTP listeners for the disabled protocols.
Also verify the Kubernetes Service ports that are exposed to clients:
5. Connect with TLS
Use amqps:// for AMQP clients:
%2f is the URL-encoded form of the default / virtual host. Replace it with the URL-encoded virtual host that your application uses.
Use TLS options when running rabbitmqadmin against the management API:
If the client certificate, key, or CA path is wrong, rabbitmqadmin fails before it can authenticate to RabbitMQ.
Verification
Use the following checks after enabling TLS: