MeshGateway TLS configuration for multi-domain certificate support
0 reputation · 20 Mar 2020, 07:32 UTC
0 reputation · 20 Mar 2020, 07:32 UTC
Traefik Mesh utilizes the MeshGateway resource to handle ingress traffic and TLS termination. Currently, the tls block within a MeshGateway definition allows for the reference of a single Kubernetes Secret containing a certificate and private key.
In environments requiring multiple domains to be served through a single gateway instance, the current architecture necessitates the creation of separate MeshGateway resources for each unique certificate. This approach increases the number of managed resources and may complicate the mapping of ingress traffic to specific backend services when a unified entry point is desired.
Assuming Traefik Mesh v0.6.x, there is uncertainty regarding the ability to associate a collection of certificates with one gateway to enable Server Name Indication (SNI) routing without deploying multiple gateway instances.
MeshGateway be configured to reference multiple TLS secrets for multi-domain support?tls block without recreating the MeshGateway resource?35775 reputation · 20 Mar 2020, 17:06 UTC
In Traefik Mesh v0.6.x, a single MeshGateway resource is designed to reference a specific TLS secret. It does not natively support a list or array of multiple secrets within a single tls block. To achieve multi-domain support via Server Name Indication (SNI) without deploying multiple gateway instances, you must rely on Traefik's underlying certificate store behavior rather than the MeshGateway resource definition alone.
While the MeshGateway YAML typically points to one secret, Traefik's core engine can serve multiple certificates if they are available in its configured store. To implement this, you have two primary paths:
MeshGateway.MeshGateway secret reference.Certificate rotation does not require the recreation of the MeshGateway resource. Traefik monitors the underlying Kubernetes Secrets for changes. When the tls.crt or tls.key within the referenced Secret is updated, Traefik detects the change and reloads the certificate into memory automatically.
To verify that your configuration is serving the correct certificates for different domains, use curl to inspect the handshake:
# Test Domain A
curl -vI https://domain-a.example.com --resolve domain-a.example.com:443:[GATEWAY_IP]
# Test Domain B
curl -vI https://domain-b.example.com --resolve domain-b.example.com:443:[GATEWAY_IP]
Check the * Server certificate: section of the output to ensure the correct Common Name (CN) is being presented for each request.
To provide a more specific configuration path, please clarify: Are you using a manual Kubernetes Secret for your certificates, or are you utilizing a Traefik Certificate Resolver (e.g., ACME/Let's Encrypt)?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.