Skip to content
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

Nginx ingress controller - Why tls passthrough to backend is not working with wildcard?? #13164

Open
eldarcar opened this issue Apr 6, 2025 · 2 comments
Labels
kind/support Categorizes issue or PR as a support question. needs-priority triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@eldarcar
Copy link

eldarcar commented Apr 6, 2025

I am executing cull command with:
curl -k -v -XPUT --cert ./muse-sbi.crt --key ./muse-sbi-privatekey.pem --cacert ./current-muse-nbi-ca-root.crt --pass LS5cbqYDAx0DpV0WKCh9 https://muse.eldar-sor-test.com/users-mng/isAuthenticated

In the response I am getting back from nginx-igress-controller the default cecrtificate "Kubernetes Ingress Controller Fake Certificate" and certificate are not pass to my backend.

Ingress controller object defined this way:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
meta.helm.sh/release-name: mi-gateway
meta.helm.sh/release-namespace: mi-paas
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: 128k
nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
creationTimestamp: "2025-04-06T14:18:40Z"
generation: 7
labels:
app.kubernetes.io/managed-by: Helm
name: mi-gateway-ingress
namespace: mi-paas
resourceVersion: "3439272"
uid: 7205880c-0465-4a59-8919-c424dba40ad7
spec:
ingressClassName: nginx
rules:

  • host: eldar-sor-test.com
    http:
    paths:
    • backend:
      service:
      name: mi-gateway
      port:
      number: 4433
      path: /
      pathType: Prefix
  • host: '*.eldar-sor-test.com'
    http:
    paths:
    • backend:
      service:
      name: mi-gateway
      port:
      number: 4433
      path: /
      pathType: Prefix
      status:
      loadBalancer:
      ingress:
    • ip: 10.88.16.244

when I am sending this curl it work fine:
curl -k -v -XPUT --cert ./muse-sbi.crt --key ./muse-sbi-privatekey.pem --cacert ./current-muse-nbi-ca-root.crt --pass LS5cbqYDAx0DpV0WKCh9 https://eldar-sor-test.com/users-mng/isAuthenticated

If I am changing my ingress object to be , with explicit host in rule (without wildcard) it works ok:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
meta.helm.sh/release-name: mi-gateway
meta.helm.sh/release-namespace: mi-paas
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: 128k
nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
creationTimestamp: "2025-04-06T14:18:40Z"
generation: 8
labels:
app.kubernetes.io/managed-by: Helm
name: mi-gateway-ingress
namespace: mi-paas
resourceVersion: "3444909"
uid: 7205880c-0465-4a59-8919-c424dba40ad7
spec:
ingressClassName: nginx
rules:

  • host: eldar-sor-test.com
    http:
    paths:
    • backend:
      service:
      name: mi-gateway
      port:
      number: 4433
      path: /
      pathType: Prefix
  • host: muse.eldar-sor-test.com
    http:
    paths:
    • backend:
      service:
      name: mi-gateway
      port:
      number: 4433
      path: /
      pathType: Prefix
      status:
      loadBalancer:
      ingress:
    • ip: 10.88.16.244

curl -k -v -XPUT --cert ./muse-sbi.crt --key ./muse-sbi-privatekey.pem --cacert ./current-muse-nbi-ca-root.crt --pass LS5cbqYDAx0DpV0WKCh9 https://muse.eldar-sor-test.com/users-mng/isAuthenticated
tls negotiation between client to backend mi-gateway works as expected.

why tls passthrough to backend is not working with wildcard??

@eldarcar eldarcar added the kind/bug Categorizes issue or PR as related to a bug. label Apr 6, 2025
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Apr 6, 2025
@longwuyuan
Copy link
Contributor

Readers here do not know the details like Subject and Alt-Subject of the cert in the backend. So its not possible to comment based on any data.

One guess is that the cert in the backend does not meet the requirements of your curl request. But that is out of the scope of the controller.

/remove-kind bug
/kind support
/triage needs-information

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it. and removed kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 6, 2025
@rkevin-arch
Copy link

This is a duplicate of #11982, but it was closed as not planned. You can either build your own controller based off of my PR #12701 (basically forking your own ingress-nginx), or for me I've decided to have a HAProxy fronting ingress-nginx to handle TLS passthrough while still using ingress-nginx as an ingress controller. Since there have been multiple other bugs related to how ingress-nginx does TLS passthrough (such as #11424 and it not supporting the PROXY protocol), and it seems like the maintainers want to deprecate this feature due to resource constraints, it's probably a good idea to not use TLS passthrough in ingress-nginx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. needs-priority triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
Development

No branches or pull requests

4 participants