I have a Kubernetes (v1.25.2) cluster running with cert-manager
1.11.0 and Traefik
2.9.6.
For some services I want Let's Encrypt
to auto sign certificates. For some reason, it feels nicer, to use IngressRoute
instead of Ingress
. I just can't get the IngressRoute to create the certificate.
Now, I have the a ClusterIssuer
:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: traefik
and, working, corresponding Ingress
:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myapp-name-websecure
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: traefik
rules:
- host: my.host.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: linkingservice
port:
number: 80
tls:
- hosts:
- my.host.com
secretName: some-secret-name-tls
This works, nice. Instead, with IngressRoute
the base resource is this:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: myapp-other-name-websecure
spec:
entryPoints:
- websecure
routes:
- match: Host(`other.host.com`)
kind: Rule
services:
- name: linkingservice
port: 80
tls:
# certResolver: ??? # resolve what? Doesn't link with the ClusterIssuer
# issuerRef: ??? # doesn't exist (anymore)
Now, I've tried to:
- just as for the
Ingress
to use theannotations
:cert-manager.io/cluster-issuer: letsencrypt-prod
. Which is being ignored - use the
tls.certResolver
, which doesn't work, because it doesn't exist. Should I create one? I expect TheClusterIssuer
to create the certificate and secret, just as it does forIngress
. - I also saw the
issuerRef
as option in thetls
section, but that doesn't appear to exist.
I thought I read that the IngressRoute
is like a layer on top of the k8s default Ingress
, so it should be something logical/similar
FYI: the ClusterIssuer
and Ingress
will also work for Nginx
, when you replace the solvers.http01.ingress.class
with nginx
, likewise for the Ingress
's spec.ingressClassName
. (perhaps also without, but I can't test)