'Traefik V2 get wildcard certificate

I have basic setup running after following this tutorial

But struggling to get wildcard certificate for domain from Let's Encrypt.

traefik configuration :

traefik.toml: |
  ## static configuration
  [global]
    checkNewVersion = true

  [entryPoints]
    [entryPoints.web]
      address = ":80"
    [entryPoints.websecure]
      address = ":443"

  [providers]
    [providers.kubernetesCRD]
    [providers.file]
      directory = "/etc/traefik/providers/"
      watch = true

  [log]
    level = "INFO"

  [accessLog]

  [api]
    insecure = true
    dashboard = true
    debug = true

  [metrics]
    [metrics.prometheus]
      buckets = [0.1,0.3,1.2,5.0]
      addEntryPointsLabels = true
      addServicesLabels = true
      entryPoint = "web"

  [ping]
    entryPoint = "web"

  [certificatesResolvers]
    [certificatesResolvers.default]
      [certificatesResolvers.default.acme]
        email = "[email protected]"
        caServer = "https://acme-v02.api.letsencrypt.org/directory"
        storage = "acme.json"
        [certificatesResolvers.default.acme.dnsChallenge]
          provider = "route53"
          delayBeforeCheck = 0
          resolvers = ["1.1.1.1:53", "8.8.8.8:53"]

dynamic.toml: |
  ## dynamic configuration
  (Empty)

and route config :

---

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-admin
  namespace: kube-system
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`traefik.domain.ca`)
    kind: Rule
    services:
    - name: traefik
      port: 8080

---

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: whoami-notls
  namespace: kube-system
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`traefik.domain.ca`) && PathPrefix(`/notls`)
    kind: Rule
    services:
    - name: whoami
      port: 80

---

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: whoami-tls
  namespace: kube-system
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`traefik.domain.ca`) && PathPrefix(`/tls`)
    kind: Rule
    services:
    - name: whoami
      port: 80
  tls:
    certResolver: default

I am able to get certificate for traefik.domain.ca but need to get wildcard certificate for entire domain (*.domain.ca). I am not able find any direct reference config for this.

What I am missing here ?



Solution 1:[1]

Updating the tls block worked.

tls:
  certResolver: default
  domains:
    - main: dev.domain.ca
      sans:
        - "dev.domain.ca"
        - "*.dev.domain.ca"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pyrology