-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Certificates HTTP-01 LE challenge with ingress-nginx #354
Comments
Weird - Please post your full |
And are you 100% positive that your DNS points to the generated ingress LB IPs? Both A and AAAA records? If you just did the change, make sure to give some time for the DNS to propagate or set the same DNS servers you have on the cluster, there is a variable for that. You can also use the |
@mysticaltech , Yes, I am sure about DNS, because I use external-dns and verified the A records are updated. As I said before, the challege URL is accessible from browser. I create a module called kube-environment to add more modules (like external-dns and grafana) Here is the default variables list
And this is how I am using
Here is the ingress: (I have used this ingress before in other managed k8s clusters)
|
@ashokspeelyaal Thanks for sharing those details, first time I see it done that way for the module, interesting! Your physical location and the location of the cluster in the cloud are not the same. The DNS servers in the cloud may not have been propagated with your changes at the time you tried. Please retry and let me know! |
I'm actually having exactly the same issue setting up a cluster right now. I have the feeling it has something to do with the loadbalancer not being able to redirect traffic from inside the cluster back to the cluster out of some reason or it's an issue with hetzner in general right now. |
I found the reason why that happens. It seems like the Hetzner Loadbalancer does handle internal traffic differently to external traffic. Especially it doesn't send the PROXY protocol header for internal traffic it seems so nginx ingress doesn't know what to do with it. nginx ingress seems to only allow either proxy header or not depending on the configuration. Not sure how traefik handles that. I've now turned off the proxy protocol by setting this from the nginx config:
and this to the service annotations:
Now both external and internal traffic works as expected. However that means that we only get the IP of the loadbalancer in the kube cluster I guess as nginx ingress doesn't know about the real ip anymore. |
Interesting issue, thanks for contributing a solution @WolfspiritM! |
@phaer Any ideas on how to fix this for good? |
@ashokspeelyaal @WolfspiritM I found the issue. It's related to cert-manager/cert-manager#466. Could you folks please try setting this annotation to the nginx service, it should fix it, but I need confirmation:
And it should be given the value of an FQDN that points to your LB. Please let me know how it goes, folks! 🙏 If this works, we could just explain the procedure in the docs. Sources: |
This seems to have fixed it! I'm still not exactly sure what that changed, cause even curl requests from the agent machines directly didn't work but setting the hostname resolved it somehow. So what I understand is that somehow traffic to the external loadbalancer ip is redirected directly to the nginx ingress service which then doesn't have the proxy-ip. My guess is that setting the hostname somehow makes nginx ingress aware that the request is coming from the loadbalancer instead of from internally?! |
Thanks for trying, @WolfspiritM; yes, exactly... It takes the "external route" somehow. The problem with the "internal route," from my understanding, was that it lacks the PROXY header. By setting the hostname, we bypass that issue! |
README.md updated; you can find the new recommendation in |
Thanks a lot @mysticaltech @WolfspiritM |
Thanks @mysticaltech and @WolfspiritM! |
@RudlTier Just a public subdomain that maps to the loadbalancer. In our case we use lb.demo.com. It doesn't mean that it's using just that domain for TLS. |
@WolfspiritM thanks for the quick answer. that worked! :) |
If you use This is a known problem across EVERY cloud provider, here's the source: Reason: I enable the proxy protocol on the load balancers so that my ingress controller and applications can "see" the real IP address of the client. However when this is enabled, there is a problem where cert-manager fails http01 challenges; you can find an explanation of why here but the easy fix provided by some providers - including Hetzner - is to configure the load balancer so that it uses a hostname instead of an IP. Again, read the explanation for the reason but if you care about seeing the actual IP of the client then I recommend you use these two annotations. |
I have the cluster setup and running, I have the below config with respect to ingress controller and cert_manager
Then I have created a cluster issuer as below,
But the certificates are not being issued. I see the below status
When I check the logs of cert-manager pod, I see this error
E1018 07:56:31.619347 1 sync.go:190] cert-manager/challenges "msg"="propagation check failed" "error"="failed to perform self check GET request 'http://<mydomain>/.well-known/acme-challenge/TFjxhOtvqJusiURDD5OZHATbUuchvFdfmZNQ': Get \"http://<mydomain>/.well-known/acme-challenge/TFjxhOtvqJugBOEfl9siURDD5OZHATbUuchvFdfmZNQ\": EOF" "dnsName"="<mydomain>" "resource_kind"="Challenge" "resource_name"="tls-grafana-nonprod-vmnbr-468113688-1685101689" "resource_namespace"="grafana-stack" "resource_version"="v1" "type"="HTTP-01"
As per the cert-manager community, the url
http://<mydomain>/.well-known/acme-challenge/TFjxhOtvqJusiURDD5OZHATbUuchvFdfmZNQ
is accessible with in the clusterI am able to access this url from browser, but When I try to curl from a pod I get 52: empty reply from server
If any of you have done this successfully, can you let me know what needs to be fixed?
The text was updated successfully, but these errors were encountered: