Hey,
for plain-old-ingresses there is the possibility to configure the certificate for cert-manager without the need to define a Certificate
resource manually:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: traefik
cert-manager.io/cluster-issuer: letsencrypt-prod-traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
name: app
namespace: app
spec:
rules:
- host: app.yourdomain.com
http:
paths:
- backend:
serviceName: app
servicePort: 80
path: /
tls:
- hosts:
- app.yourdomain.com
secretName: app-tls
Is this also possible for IngressRoute resources yet?
I found this in the documentation, but I'm not sure if I understand it correctly:
When using the Traefik Kubernetes CRD Provider, unfortunately Cert-Manager cannot yet interface directly with the CRDs. A workaround is to enable the Kubernetes Ingress provider to allow Cert-Manager to create ingress objects to complete the challenges. Please note that this still requires manual intervention to create the certificates through Cert-Manager, but once the certificates are created, Cert-Manager keeps them renewed.
see: Kubernetes IngressRoute & Traefik CRD - Traefik
Does this mean this is not possible (yet) and I have to create the Certificate
resource manually? Is there a issue in the Traefik or CertManager issue tracker concerning this?
My current working setup looks like this:
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: app.yourdomain.com-cert
namespace: app
spec:
commonName: app.yourdomain.com
secretName: app.yourdomain.com-cert
dnsNames:
- app.yourdomain.com
issuerRef:
kind: ClusterIssuer
name: letsencrypt-prod-traefik
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: app
namespace: app
spec:
entryPoints:
- websecure
routes:
- match: Host(`app.yourdomain.com`)
kind: Rule
services:
- kind: Service
name: app
port: 80
tls:
secretName: app.yourdomain.com-cert
domains:
- main: app.yourdomain.com
But I would really like to use an automatic way here, if possible.
When doing it this way I had the problem, that the certificate could not be issued while the IngressRoute resource existed. Only after I deleted both and recreated the Certificate
resource the request was successful and I could create the IngressRoute again and have a working setup. But I'm a bit concerned now, that this will again be an issue once the certificate runs out. Is this an issue? Or should this work (which would mean I did face another issue there)?
Thanks in advance!