Report this

What is the reason for this report?

Set up cert-manager for kubernetes with multiple domain names

Posted on August 25, 2021

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 ingress_nginx_svc.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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.