Using multiple domains and TLS certs on Traefik on Kubernetes

The Scenario

I need to have my website behind Traefik to allow HTTPS access by using both https://domainA.com/ and https://domainB.com and I got TLS certificates for domainA.com and domainB.com respectively (paid already).

The way / solution that work for me

Deployment of certificates with secrets

As I am using Kustomize, this is part of the config they included the creation on secret using secretGenerator (one can use other way to prepare the secret, e.g. like using CLI)

Don’t bother the traefik-tls-certs, that’s for some other use

Mount the files as secret

As I am using Helm chart for my Traefik deployment, I use the following config file to mount volumes to those secret as a path later I can refer to with traefik config file.

Duplicate rules for each domain and have the cert apply to different router

(What have not been working / line of thought…skip if you prefer)

What I am not sure if needed

I do add the default certificates in traefik config file (deploy as configmap as a file mounted) but not sure if it’s needed.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store