nginxinc / kubernetes-ingress

NGINX and NGINX Plus Ingress Controllers for Kubernetes
https://docs.nginx.com/nginx-ingress-controller
Apache License 2.0
4.67k stars 1.97k forks source link

SNI routingmodule and routing of TCP traffic with TransportServer #6324

Closed shaun-nx closed 2 weeks ago

shaun-nx commented 2 months ago

Overview

As a maintainer of NGINX Ingress Controller, I would like to enable users of our TransportServer resource to route traffic to their backend services using a Server Name Indicator (SNI) provided by a Host Header, so that resources hosted on the same server can be identified by their host name, even if they are on the same host IP.

High-level Functional Requirements

Definition of Done

Development

Testing

Release Notes & Documentation


Additional Context

SNI based routing of Layer 4 traffic is a way to support customers using DNS names for TCP traffic and support routing based on the SNI header. With NGINX this is implemented using the stream ssl pre-read module. https://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html

This module is already present in the NGINX Plus binary.

Today, this is possible with heavy use of snippets. The ask is to make this present and first class with the TransportServer resource.

This also historically described here: https://stackoverflow.com/questions/34741571/nginx-tcp-forwarding-based-on-hostname

There are some additional considerations that need to be included here:

The overall concept is multiple upstream targets for TCP behind a single listener and to route based on SNI. This would support both TLS Passthrough as well as advanced programmability that might require TLS decryption and re-encryption.

To bring this all together:

TLS traffic in -> TransportServer matched TLS of HostHeader -> Routes to appropriate upstream based on HostHeader

### POC Tasks
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/6438
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/6439
### Implementation Tasks
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/6440
github-actions[bot] commented 2 months ago

Hi @shaun-nx thanks for reporting!

Be sure to check out the docs and the Contributing Guidelines while you wait for a human to take a look at this :slightly_smiling_face:

Cheers!