Question

Set up cert-manager for kubernetes with multiple domain names

Posted August 25, 2021 208 views
NginxKubernetes

I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes

And it worked at first, I set it up for one domain I have, and also for a subdomain, all seems good. I needed, though, to add another domain and it doe snot seem to work. after following the tutorial, what I did is to go to the ingress for my websites and do like this:

code
annotations:
  kubernetes.io/ingress.class: nginx
  cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  tls:
  - hosts:
    - mydomain.com
    - hello.mydomain.com
    - my-SECOND-domain.com
    - smething.my-SECOND-domain.com
    secretName: hello-kubernetes-tls

but in the ingressnginxsvc.yaml I have:

code
metadata:
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: 'true'
    service.beta.kubernetes.io/do-loadbalancer-hostname: "mydomain.com"

Now I have my DNS records pointing to the external IP but for the my-SECOND-domain.com entries, when navigating to the page, I have an invalid certificate, chrome tells me that is using: FAKE acme certificate, while for the other domain the certificate is valid

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Interesting, I wonder if since your TLS secret is already created and not expired, cert-manager doesn’t try to update it with the new domain names.

You could try deleting the ingress and TLS secret and recreating them.

But probably the better solution (to avoid having to delete and recreate certs) is to create a new ingress object for your new domain:

code
annotations:
  kubernetes.io/ingress.class: nginx
  cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  tls:
  - hosts:
    - my-SECOND-domain.com
    - smething.my-SECOND-domain.com
    secretName: seconddomain-kubernetes-tls