0

I am trying to deploy a React website together with an Express API on GKE. There should be multiple subdomains for both the website and the API, i.e.

  • domain.com, a.domain.com, b.domain.com, ... -> React app
  • api.domain.com, a.api.domain.com, b.api.domain.com -> Express API

The reasoning behind this is that the application is using cookie-based authentication, so the API and app need to be on the same subdomain (e.g. a.domain.com and api.a.domain.com). Cert-manager and nginx ingress were deployed in the Kubernetes cluster with commands:

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.2/cert-manager.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml

Everything works fine when I explicitly put all subdomains in the ingress and give each a separate TLS entry in the ingress. The certificates are successfully issued. But when using wildcards the certificates never get ready and when I try to open api.domain.com or domain.com it returns a "page not found" error.

# ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
    cert-manager.io/issuer: letsencrypt-production
spec:
  rules:
  - host: "*.domain.com"
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: react
            port:
              number: 80
  - host: wordpress.domain.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: wordpress
            port:
              number: 80
  - host: "*.api.domain.com"
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: api
            port:
              number: 9000
  tls:
  - hosts:
    - "*.domain.com"
    - domain.com
    secretName: certificate-wildcard-domain
  - hosts:
    - "wordpress.domain.com"
    secretName: certificate-wordpress-domain
  - hosts:
    - "*.api.domain.com"
    - api.domain.com
    secretName: certificate-api-domain

This is what is showing in the logs of the cert-manager pod:

 cert-manager/orders "msg"="Failed to determine the list of Challenge resources needed for the Order" "error"="no configured challenge solvers can be used for this challenge" "resource_kind"="Order" "resource_name"="certificate-api-domain-9wvd9-2527200272" "resource_namespace"="default" "resource_version"="v1"

I do not understand the problem, why certificates are not issued correctly for wildcard entries and the website is not reachable, while e.g. for wordpress.domain.com the certificates are issued successfully and the website can be reached.

needRhelp
  • 2,948
  • 2
  • 24
  • 48

1 Answers1

1

Issuer/ClusterIssuer solvers(Try Upgrade from v0.10 to v0.11)

Update the apiVersion on all your backed up resources from certmanager.k8s.io/v1alpha1 to cert-manager.io/v1alpha2

Support for the deprecated spec.http01 or spec.dns01 fields in Issuer and ClusterIssuer have been removed. Any Issuer or ClusterIssuer objects must be converted to use the equivalent spec.solvers[].http01 or spec.solvers[].dns01 syntax. You can read more about the Issuer resource in the configuration documentation.

Any issuers that haven't been converted will result in the cert-manager pod being unable to find any solvers at the expected location. This will result in errors like the following: no configured challenge solvers can be used for this challenge.

Let’s Encrypt issues wildcard certificates via ACMEv2 using the DNS-01 challenge. See ACME v2 Production Environment & Wildcard certificates for more technical information. Cert-manager.io: Docs: Configuration: ACME: DNS-01 contains details on the different options available on the Issuer resource's DNS01 challenge solver configuration.

Refer to No configured Challenge Solvers for ACME Prod only #2494 for more information, which may help to resolve your issue.

Veera Nagireddy
  • 1,656
  • 1
  • 3
  • 12
  • Thanks for providing the links to the documentation. It seems that wildcard certificates are currently only supported with DNS-01 challenge type which is causing the error in my case as I am using http01 challenge. – needRhelp Jan 14 '23 at 15:40