I followed this DigitalOcean guide https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes, and I came across something quite strange. When in the hostnames I set a wildcard, then letsencrypt
fails in issuing a new certificate. While when I only set defined sub-domains, then it works perfectly.
This is my "working" configuration for the domain and its api (and this one works perfectly):
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-staging"
spec:
tls:
- hosts:
- example.com
- api.example.com
secretName: my-tls
rules:
- host: example.com
http:
paths:
- backend:
serviceName: example-frontend
servicePort: 80
- host: api.example.com
http:
paths:
- backend:
serviceName: example-api
servicePort: 80
And this is, instead, the wildcard certificate I’m trying to issue, but that fails to do leaving the message "Issuing".
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-staging"
spec:
tls:
- hosts:
- example.com
- *.example.com
secretName: my-tls
rules:
- host: example.com
http:
paths:
- backend:
serviceName: example-frontend
servicePort: 80
- host: api.example.com
http:
paths:
- backend:
serviceName: example-api
servicePort: 80
The only difference is the second line of the hosts. Is there a trivial well known solution I am not aware of? I am new to Kubernetes, but not to DevOps.
2
Answers
Generating wildcard certificate with
cert-manager
(letsencrypt
) requires the usage ofDNS-01
challenge instead ofHTTP-01
used in the link from the question:There is a documentation about generating the
wildcard
certificate withcert-manager
:From the perspective of DigialOcean, there is a guide specifically targeted at it:
I’d reckon this additional resources could also help:
Wildcard cert require
DNS-01
methodNote : You might require to first add the CAA record in your DNS.
CAA record can get added into DNS zone
example :
get details from : https://sslmate.com/caa/
First, you have to create the secret for storing the
access key
using the commandHere sharing the example
issuer.yaml
Also, make sure your user has necessary permission to manage the
Route53