Skip to content

http-01 self check failed for domain #656

Closed

Description

@AmbroiseCouissin

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened:
I get the message: http-01 self check failed for domain ""

$ kubectl describe certificates website-cert

Name:         website-cert
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"certmanager.k8s.io/v1alpha1","kind":"Certificate","metadata":{"annotations":{},"name":"website-cert","namespace":"default"},"spe...
API Version:  certmanager.k8s.io/v1alpha1
Kind:         Certificate
Metadata:
  Cluster Name:
  Creation Timestamp:  2018-06-14T14:56:48Z
  Generation:          0
  Resource Version:    14514530
  Self Link:           /apis/certmanager.k8s.io/v1alpha1/namespaces/default/certificates/website-cert
  UID:                 2a172bc7-6fe3-11e8-a23d-00163e0067a2
Spec:
  Acme:
    Config:
      Domains:
        <redacted>.com
      Http 01:
        Ingress:  ingress
  Common Name:
  Dns Names:
    <redacted>.com
  Issuer Ref:
    Name:       letsencrypt-issuer-staging
  Secret Name:  website-cert
Status:
  Acme:
    Order:
      Challenges:
        Authz URL:  https://acme-staging-v02.api.letsencrypt.org/acme/authz/d4lkE7p4egv_GNHKOGkIZeNxANPhc4icVwX6ceSfvfQ
        Domain:     <redacted>.com
        Http 01:
          Ingress:  ingress
        Key:        VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw.UYrPMOqVi1SlKjy8hYE4t6mdtpuoNxCAANIaDzkZhw0
        Token:      VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw
        Type:       http-01
        URL:        https://acme-staging-v02.api.letsencrypt.org/acme/challenge/d4lkE7p4egv_GNHKOGkIZeNxANPhc4icVwX6ceSfvfQ/135522965
        Wildcard:   false
      URL:          https://acme-staging-v02.api.letsencrypt.org/acme/order/6285995/2040425
  Conditions:
    Last Transition Time:  2018-06-14T14:56:56Z
    Message:               http-01 self check failed for domain "<redacted>.com"
    Reason:                ValidateError
    Status:                False
    Type:                  Ready
Events:
  Type    Reason       Age   From          Message
  ----    ------       ----  ----          -------
  Normal  CreateOrder  4s    cert-manager  Created new ACME order, attempting validation...

If I get all the events:

I0614 15:03:16.667525       1 controller.go:177] certificates controller: syncing item 'default/website-cert'
I0614 15:03:16.667660       1 sync.go:239] Preparing certificate default/website-cert with issuer
I0614 15:03:16.667674       1 acme.go:159] getting private key (letsencrypt-issuer-staging->tls.key) for acme issuer default/letsencrypt-issuer-staging
I0614 15:03:16.668072       1 logger.go:27] Calling GetOrder
I0614 15:03:16.876856       1 logger.go:52] Calling GetAuthorization
I0614 15:03:17.065635       1 logger.go:72] Calling HTTP01ChallengeResponse
I0614 15:03:17.065678       1 prepare.go:263] Cleaning up old/expired challenges for Certificate default/website-cert
I0614 15:03:17.065696       1 logger.go:47] Calling GetChallenge
I0614 15:03:17.266766       1 helpers.go:162] Found status change for Certificate "website-cert" condition "Ready": "False" -> "False"; setting lastTransitionTime to 2018-06-14 15:03:17.266752283 +0000 UTC m=+20046.828096097
I0614 15:03:17.266805       1 sync.go:241] Error preparing issuer for certificate default/website-cert: http-01 self check failed for domain "<redacted>.com"
E0614 15:03:17.272906       1 sync.go:168] [default/website-cert] Error getting certificate 'website-cert': secret "website-cert" not found
E0614 15:03:17.272958       1 controller.go:186] certificates controller: Re-queuing item "default/website-cert" due to error processing: http-01 self check failed for domain "<redacted>.com"

What you expected to happen:
The self check to succeed

How to reproduce it (as minimally and precisely as possible):
Here is my Ingress:

spec:
  tls:
    - hosts:
        - <redacted>.com
      secretName: website-cert
  rules:
    - host: <redacted>.com
      http:
        paths:
          - backend:
              servicePort: 80
              serviceName: website
            path: /
          - backend:
              servicePort: 8089
              serviceName: cm-acme-http-solver-7lvgt
            path: >-
              /.well-known/acme-challenge/VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw
apiVersion: extensions/v1beta1
status:
  loadBalancer:
    ingress:
      - ip: {IP}
kind: Ingress
metadata:
  uid: 6c304201-6fe2-11e8-8294-00163e020142
  resourceVersion: '14515959'
  name: ingress
  creationTimestamp: '2018-06-14T14:51:30Z'
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/ingress
  generation: 4
  namespace: default

Here is my Issuer:

apiVersion: certmanager.k8s.io/v1alpha1
kind: Issuer
metadata:
  name: letsencrypt-issuer-staging
  namespace: default
spec:
  acme:
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    email: <redacted>

    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-issuer-staging
    http01: {}

Here is my certificate:

apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
  name: website-cert
spec:
  secretName: website-cert
  dnsNames:
  - <redacted>.com
  acme:
    config:
    - http01:
        ingress: ingress
      domains:
      - <redacted>.com
  issuerRef:
    name: letsencrypt-issuer-staging

Anything else we need to know?:
When I navigate to

http://<redacted>.com/.well-known/acme-challenge/VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw

I get:

VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw.UYrPMOqVi1SlKjy8hYE4t6mdtpuoNxCAANIaDzkZhw0

Also, if I look at the logs of the cm-acme pod:

2018/06/14 17:31:58 [<redacted>.com] Validating request. basePath=/.well-known/acme-challenge, token=VPf6GKhjZO3CZ4VNjlv6yjg4_7W38X5FZ78pXVJ56Bw
2018/06/14 17:31:58 [<redacted>.com] Comparing actual host '<redacted>.com' against expected '<redacted>.com'
2018/06/14 17:31:58 [<redacted>.com] Got successful challenge request, writing key...

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-12T14:26:04Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.7", GitCommit:"dd5e1a2978fd0b97d9b78e1564398aeea7e7fe92", GitTreeState:"clean", BuildDate:"2018-04-18T23:58:35Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration**: Aliyun Container Service
  • Install tools:
  • Others:

I've been struggling for two days. It's probably something really stupid from my side :)

Any idea?

Activity

  1. AmbroiseCouissin commented on Jun 15, 2018

    @AmbroiseCouissin
    Author

    The problem solved by itself today. I don't know how.

    Thanks for cert-manager. It's really a great tool!

  2. arianitu commented on Jun 19, 2018

    @arianitu

    I'm running into the same thing. I see in the logs say writing key..., but if I look at the certificate, it says its still validating it.

    Super buggy

  3. munnerz commented on Jun 19, 2018

    @munnerz
    Member
  4. oxlarrysh commented on Jun 19, 2018

    @oxlarrysh

    I am running into this same issue, How long does it take?

  5. AmbroiseCouissin commented on Jun 21, 2018

    @AmbroiseCouissin
    Author

    It took me two-three days. But now when generate certificates for other subdomains, it takes less than a minute.

  6. oanogin commented on Jun 27, 2018

    @oanogin

    it's strange behavior, i have 2 dns names (asd.team1.example.com and asd.another.com), and interesting points are:

    • with asd.team1.example.com domain - everything works fine
    • with certbot on this machine and both dns - everything works fine
    • both domains is also accessible ( http version of service works fine )

    And only for asd.another.com i can't obtain cert by cert-manager, but with certbot on this machine everything works fine

    :(

  7. hekonsek commented on Jul 10, 2018

    @hekonsek

    I encountered the same issue. Any address I choose for my app works, except a single one whose validation is blocked by http-01 self check failed for domain error. In particular http://foo.mydomain.com doesn't work, but for example http://foo-app.mydomain.com works like a charm and can be validated in less than a minute.

    I'm trying to figure our from logs what could be a reason for this single subdomain to fail self check validation.

  8. gabx commented on Jul 28, 2018

    @gabx

    Same error as the OP. Here is my certificate.yaml file. certificate has been created, but since then, no LTS certificate from let's encrypt.

    % cat longhorn-certificate.yaml 
    apiVersion: certmanager.k8s.io/v1alpha1
    kind: Certificate
    metadata:
      name: longhorn-thetradinghall-com
      namespace: default
    spec:
      secretName: longhorn-thetradinghall-com-tls
      issuerRef:
        name: letsencrypt-cluster
        kind: ClusterIssuer
      dnsNames:
      - longhorn.thetradinghall.com
      acme:
        config:
        - http01:
            ingressClass: nginx
          domains:
          - longhorn.thetradinghall.com
    
  9. maresende commented on Aug 2, 2018

    @maresende

    Same error as OP.(2)

  10. Zetanova commented on Aug 3, 2018

    @Zetanova

    updated now from v2.5
    I tried ingressClass: nginx and ingress: my-ingress

    With the last the ingress get with the acme collange extended
    and can be quired successfully in the browser.

    cert-manager still logs:
    http-01 self check failed for domain "mydomain.tt"

  11. Zetanova commented on Aug 3, 2018

    @Zetanova

    I could solve it.

    The hairpin mode of the NLB in front of the cluster didnt work.

  12. ngo275 commented on Aug 10, 2018

    @ngo275

    I ran into the same problem.. but I tried it again after a while then it succeeded..!
    This is weird..

  13. Darwinyo commented on Aug 20, 2018

    @Darwinyo

    i just have same problem today.
    I have 5 domains to validate.
    www.farmersflorals.com, farmersflorals.com, api.farmersflorals.com, identity.farmersflorasl.com, and blog.farmersflorals.com.

    only 3 of those validated www.farmersflorals.com, farmersflorals.com, and identity.farmersflorals.com

    other not.

    all of those refer to same IP, i could access all of them, but only 3 validated, that's weird.

    i'm using helm chart version 0.4.1
    with ingress on GKE

  14. Antiarchitect commented on Aug 23, 2018

    @Antiarchitect

    Having the same issue. I have two clusters tuned absolutely identically in terms of nginx-ingress and cert-manager and the third one is lagging. all three domains self check failed. I have clusters for prod and staging - now it's QA turn. Nothing works. Logs don't say anything useful

  15. 39 remaining items

  16. hvaoc commented on Aug 5, 2020

    @hvaoc

    @Alirezahaghshenas & @jc-delvalle comments helped. For anyone who have wasted enough time using kuberctl appy with yaml and getting the this issue, here are the full set of commands

    # Install Nginx Ingress using Helm
    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm install my-nginx-ingress ingress-nginx/ingress-nginx
    kubectl --namespace default get services -o wide -w my-nginx-ingress-ingress-nginx-controller
    
    # Install cert-manager using Helm
    kubectl create namespace cert-manager
    helm repo add jetstack https://charts.jetstack.io
    helm repo update
    helm install \
      cert-manager jetstack/cert-manager \
      --namespace cert-manager \
      --version v0.16.0 \
      --set installCRDs=true 
    
  17. bergkvist commented on Sep 8, 2020

    @bergkvist

    @rbq I have the same problem as you it seems. I can't reach the endpoint from within the cluster, but I can reach it from my local workstation.

    From within the cluster vs from local workstation:
    image

    How did you fix it?

  18. bergkvist commented on Sep 8, 2020

    @bergkvist

    Turns out the internal services in the cluster were not able to reach things within the cluster through external IP because I had enabled PROXY protcol in my load balancer.

    When I disabled PROXY protocol, the certificates were issued almost immediately.

    kubectl patch -ngitlab-managed-apps service/ingress-nginx-ingress-controller -p '{"metadata":{"annotations":{"service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol":"false"}}}'
    kubectl patch -ngitlab-managed-apps configmap/ingress-nginx-ingress-controller -p '{"data":{"use-proxy-protocol":"false"}}'
    

    Which meant I could turn PROXY protocol back on:

    kubectl patch -ngitlab-managed-apps service/ingress-nginx-ingress-controller -p '{"metadata":{"annotations":{"service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol":"true"}}}'
    kubectl patch -ngitlab-managed-apps configmap/ingress-nginx-ingress-controller -p '{"data":{"use-proxy-protocol":"true"}}'
    

    My application requires the use of PROXY protocol in order to check the users IP addresses. Is there a way of fixing this without having to switch PROXY protcol on and off every 90 days to renew my certs?

  19. ashleydavies commented on Sep 11, 2020

    @ashleydavies

    Huge thanks @bergkvist, same issue here, appreciate you sharing the solution; spent all day trying everything except that it seems 😅

  20. stopsopa commented on Sep 25, 2020

    @stopsopa

    Patch for this definitely needed, and it seems that there are people/organizations willing and knowing how to help:
    kubernetes/kubernetes#66607 (comment)
    I hope it will be addressed soon because @bergkvist solution is brilliant but also pretty nasty but at the moment it looks like that's all what we have.

  21. bergkvist commented on Sep 25, 2020

    @bergkvist

    @stopsopa So there is actually another alternative, which makes the self-checks work even with PROXY protocol enabled.

    kubectl patch -ngitlab-managed-apps service/ingress-nginx-ingress-controller -p '{"metadata":{"annotations":{"service.beta.kubernetes.io/do-loadbalancer-hostname":"example.com"}}}'
    

    Notice that you have to explicitly write your hostname ("example.com") in order for the kubernetes iptables issue to be worked around. Not sure how this would work if you have multiple hostnames pointing to the same loadbalancer.

    Subdomains work fine though (like www.example.com, subdomain.example.com etc.)

  22. stopsopa commented on Sep 25, 2020

    @stopsopa

    Thanks @bergkvist mate I spent two evenings trying to make it work (cert-manager together with ip address), pulling my hair off, and actually I've been doing this too but with other configuration. I have created new cluster and tried only do-loadbalancer-hostname and... Finally worked. 🎉

  23. compumike commented on Oct 23, 2020

    @compumike

    Hi all, I ran into the same issue. I've just published hairpin-proxy which works around the issue, specifically for cert-manager self-checks. https://github.com/compumike/hairpin-proxy

    It uses CoreDNS rewriting to intercept traffic that would be heading toward the external load balancer. It then adds a PROXY line to requests originating from within the cluster. This allows cert-manager's self-check to pass.

  24. nabsul commented on Oct 24, 2020

    @nabsul

    What a coincidence. Just today I published https://github.com/nabsul/k8s-letsencrypt with instructions on how to manually issue certificates in your Kubernetes cluster. The hope being that I'll only need to manually issue certs a few times until this issue is fixed.

    I wish I'd seen @compumike 's solution sooner!!

  25. richardthombs commented on Nov 10, 2020

    @richardthombs

    @compumike Thanks so much!! 🥇

  26. ahmed-adly-khalil commented on Apr 10, 2021

    @ahmed-adly-khalil

    I was able to fix this, the chain of issues started as follow:

    I had the following in the annotation in my ingress controller

    nginx.ingress.kubernetes.io/use-regex: "true"

    nginx.ingress.kubernetes.io/rewrite-target: /

    this caused all URLs to be rewritten to /
    this caused the cert-manager to fail on self-check before communicating to let's encrypt
    this caused certificate generation not to start at all
    this also caused the DNS resolution from inside the cluster to fail

    commenting these 2 lines made things work

  27. SacMV commented on Apr 26, 2022

    @SacMV

    In my case:
    Error message: cert manager challenge remote error: tls: unrecognized name
    I added in my ingress annotations:
    cert-manager.io/issue-temporary-certificate: "true"
    acme.cert-manager.io/http01-edit-in-place: "true"

    It worked.

  28. fabioespinosa commented on Oct 25, 2022

    @fabioespinosa

    As @ahmed-adly-khalil said:

    Removing

    nginx.ingress.kubernetes.io/rewrite-target: /$1

    Worked

  29. macs1756 commented on Mar 30, 2026

    @macs1756

    I had the same issue and I didn't solve it through the libraries mentioned in that thread. Maybe the problem was because I used AWS as a cloud provider and my DNS was located on Cloudflare. I set up Cert-Manager exactly as required for Cloudflare with api token, not for general use. This may be helpful for someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions