Skip to content

Commit 7875ca5

Browse files
author
Kate Osborn
committed
Add more detail to guide and update compatibility doc
1 parent 2eeccbb commit 7875ca5

File tree

4 files changed

+104
-35
lines changed

4 files changed

+104
-35
lines changed

site/content/how-to/traffic-management/tls-passthrough.md

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: "TLS Passthrough"
3-
weight: 600
3+
weight: 800
44
toc: true
55
docs: "DOCS-000"
66
---
77

8-
Learn how to passthrough TLS connections using NGINX Gateway Fabric.
8+
Learn how to use TLSRoutes to configure TLS Passthrough load-balancing with NGINX Gateway Fabric.
99

1010
## Overview
1111

@@ -18,19 +18,14 @@ In this guide, we will show how to configure TLS passthrough for your applicatio
1818

1919
```text
2020
GW_IP=XXX.YYY.ZZZ.III
21-
GW_PORT=<port number>
22-
```
23-
24-
Save the ports of NGINX Gateway Fabric:
25-
26-
```text
27-
GW_HTTP_PORT=<http port number>
28-
GW_HTTPS_PORT=<https port number>
21+
GW_TLS_PORT=<port number>
2922
```
3023

3124
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
3225

33-
Create the tls-backend application by copying and pasting the following block into your terminal:
26+
## Set up
27+
28+
Create the `secure-app` application by copying and pasting the following block into your terminal:
3429

3530
```yaml
3631
kubectl apply -f - <<EOF
@@ -98,7 +93,7 @@ data:
9893
default_type text/plain;
9994
10095
location / {
101-
return 200 "hello from pod $hostname\n";
96+
return 200 "hello from pod \$hostname\n";
10297
}
10398
}
10499
---
@@ -112,7 +107,9 @@ data:
112107
EOF
113108
```
114109

115-
This will create the **secure-app** service and a deployment. Run the following command to verify the resources were created:
110+
This will create the **secure-app** service and a deployment. The secure app is configured to serve HTTPS traffic on port 8443 for the host app.example.com. For TLS termination, a self-signed TLS certificate, with the common name `app.example.com`, and key are used. The app responds to clients HTTPS requests with a simple text response "hello from pod $POD_HOSTNAME".
111+
112+
Run the following command to verify the resources were created:
116113

117114
```shell
118115
kubectl get pods,svc
@@ -128,7 +125,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
128125
service/secure-app ClusterIP 192.168.194.152 <none> 8443/TCP 12s
129126
```
130127

131-
Create a gateway. This will create TLS listener with the hostname *.example.com. Copy paste this into your terminal.
128+
Create a gateway. This will create a TLS listener with the hostname `*.example.com` and a TLS mode of passthrough. Copy and paste this into your terminal.
132129

133130
```yaml
134131
kubectl apply -f - <<EOF
@@ -154,7 +151,11 @@ spec:
154151
EOF
155152
```
156153

157-
Create a TLSRoute, this will reference the service and the gateway.
154+
This gateway will configure NGINX Gateway Fabric to accept TLS connections on port 443 and route them to the corresponding backend services without decryption. The routing is done based on the SNI, which allows clients to specify a server name (like example.com) during the SSL handshake.
155+
156+
{{< note >}} It is possible to add an HTTPS listener on the same port that terminates TLS connections so long as the hostname does not overlap with the TLS listener hostname. {{< /note >}}
157+
158+
Create a TLSRoute that attaches to the gateway and routes requests to `app.example.com` to the `secure-app` service:
158159

159160
```yaml
160161
kubectl apply -f - <<EOF
@@ -168,7 +169,6 @@ spec:
168169
- name: gateway
169170
namespace: default
170171
hostnames:
171-
- "cafe.example.com"
172172
- "app.example.com"
173173
rules:
174174
- backendRefs:
@@ -177,18 +177,55 @@ spec:
177177
EOF
178178
```
179179

180+
{{< note >}}To route to a service in a namespace different from the TLSRoute namespace, create a [ReferenceGrant](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1beta1.ReferenceGrant) to permit the cross-namespace reference. {{< /note >}}
181+
180182
## Send traffic
181183

182-
Using the external IP address and port for NGINX Gateway Fabric, send traffic to the coffee application.
184+
Using the external IP address and port for NGINX Gateway Fabric, send traffic to the `secure-app` application.
183185

184-
{{< note >}}If you have a DNS record allocated for `cafe.example.com`, you can send the request directly to that hostname, without needing to resolve.{{< /note >}}
186+
{{< note >}}If you have a DNS record allocated for `app.example.com`, you can send the request directly to that hostname, without needing to resolve.{{< /note >}}
185187

186-
Send a request to the `secure-app` service on the HTTPS port with the `--insecure` flag. The `--insecure` flag is required because the `secure-app` is using self-signed certificates.
188+
Send a request to the `secure-app` service on the TLS port with the `--insecure` flag. The `--insecure` flag is required because the `secure-app` is using self-signed certificates.
187189

188190
```shell
189-
curl --resolve cafe.example.com:$GW_PORT:$GW_IP https://cafe.example.com:$GW_PORT --insecure
191+
curl --resolve app.example.com:$GW_TLS_PORT:$GW_IP https://app.example.com:$GW_TLS_PORT --insecure -v
190192
```
191193

192194
```text
195+
Added app.example.com:8443:127.0.0.1 to DNS cache
196+
* Hostname app.example.com was found in DNS cache
197+
* Trying 127.0.0.1:8443...
198+
* Connected to app.example.com (127.0.0.1) port 8443
199+
* ALPN: curl offers h2,http/1.1
200+
* (304) (OUT), TLS handshake, Client hello (1):
201+
* (304) (IN), TLS handshake, Server hello (2):
202+
* (304) (IN), TLS handshake, Unknown (8):
203+
* (304) (IN), TLS handshake, Certificate (11):
204+
* (304) (IN), TLS handshake, CERT verify (15):
205+
* (304) (IN), TLS handshake, Finished (20):
206+
* (304) (OUT), TLS handshake, Finished (20):
207+
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF
208+
* ALPN: server accepted http/1.1
209+
* Server certificate:
210+
* subject: C=US; ST=CA; L=San Francisco; CN=app.example.com
211+
* start date: Mar 23 23:20:43 2020 GMT
212+
* expire date: Mar 23 23:20:43 2023 GMT
213+
* issuer: C=US; ST=CA; L=San Francisco; CN=app.example.com
214+
* SSL certificate verify result: self signed certificate (18), continuing anyway.
215+
* using HTTP/1.x
216+
> GET / HTTP/1.1
217+
> Host: app.example.com:8443
218+
> User-Agent: curl/8.6.0
219+
> Accept: */*
220+
>
221+
< HTTP/1.1 200 OK
222+
< Server: nginx/1.27.0
223+
< Date: Wed, 14 Aug 2024 20:41:21 GMT
224+
< Content-Type: text/plain
225+
< Content-Length: 43
226+
< Connection: keep-alive
227+
<
193228
hello from pod secure-app-575785644-kzqf6
194229
```
230+
231+
Note that the server certificate used to terminate the TLS connection has the subject common name of `app.example.com`. This is the server certificate that the `secure-app` is configured with and shows that the TLS connection was terminated by the `secure-app`, not NGINX Gateway Fabric.

site/content/overview/gateway-api-compatibility.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ Learn which Gateway API resources NGINX Gateway Fabric supports and to which lev
1010
## Summary
1111

1212
{{< bootstrap-table "table table-striped table-bordered" >}}
13-
| Resource | Core Support Level | Extended Support Level | Implementation-Specific Support Level | API Version |
14-
| ------------------------------------- | ------------------- | ---------------------- | ------------------------------------- | ----------- |
15-
| [GatewayClass](#gatewayclass) | Supported | Not supported | Supported | v1 |
16-
| [Gateway](#gateway) | Supported | Partially supported | Not supported | v1 |
17-
| [HTTPRoute](#httproute) | Supported | Partially supported | Not supported | v1 |
18-
| [ReferenceGrant](#referencegrant) | Supported | N/A | Not supported | v1beta1 |
19-
| [GRPCRoute](#grpcroute) | Supported | Partially supported | Not supported | v1 |
20-
| [TLSRoute](#tlsroute) | Not supported | Not supported | Not supported | N/A |
21-
| [TCPRoute](#tcproute) | Not supported | Not supported | Not supported | N/A |
22-
| [UDPRoute](#udproute) | Not supported | Not supported | Not supported | N/A |
23-
| [BackendTLSPolicy](#backendtlspolicy) | Supported | Supported | Not supported | v1alpha3 |
24-
| [Custom policies](#custom-policies) | N/A | N/A | Supported | N/A |
13+
| Resource | Core Support Level | Extended Support Level | Implementation-Specific Support Level | API Version |
14+
|---------------------------------------|--------------------|------------------------|---------------------------------------|-------------|
15+
| [GatewayClass](#gatewayclass) | Supported | Not supported | Supported | v1 |
16+
| [Gateway](#gateway) | Supported | Partially supported | Not supported | v1 |
17+
| [HTTPRoute](#httproute) | Supported | Partially supported | Not supported | v1 |
18+
| [ReferenceGrant](#referencegrant) | Supported | N/A | Not supported | v1beta1 |
19+
| [GRPCRoute](#grpcroute) | Supported | Partially supported | Not supported | v1 |
20+
| [TLSRoute](#tlsroute) | Supported | Not supported | Not supported | v1alpha2 |
21+
| [TCPRoute](#tcproute) | Not supported | Not supported | Not supported | N/A |
22+
| [UDPRoute](#udproute) | Not supported | Not supported | Not supported | N/A |
23+
| [BackendTLSPolicy](#backendtlspolicy) | Supported | Supported | Not supported | v1alpha3 |
24+
| [Custom policies](#custom-policies) | N/A | N/A | Supported | N/A |
2525
{{< /bootstrap-table >}}
2626

2727
---
@@ -123,6 +123,7 @@ See the [static-mode]({{< relref "/reference/cli-help.md#static-mode">}}) comman
123123
- `Accepted/False/UnsupportedProtocol`
124124
- `Accepted/False/InvalidCertificateRef`
125125
- `Accepted/False/ProtocolConflict`
126+
- `Accpeted/False/HostnameConflict`
126127
- `Accepted/False/UnsupportedValue`: Custom reason for when a value of a field in a Listener is invalid or not supported.
127128
- `Accepted/False/GatewayConflict`: Custom reason for when the Gateway is ignored due to a conflicting Gateway. NGINX Gateway Fabric only supports a single Gateway.
128129
- `Programmed/True/Programmed`
@@ -131,6 +132,7 @@ See the [static-mode]({{< relref "/reference/cli-help.md#static-mode">}}) comman
131132
- `ResolvedRefs/False/InvalidCertificateRef`
132133
- `ResolvedRefs/False/InvalidRouteKinds`
133134
- `Conflicted/True/ProtocolConflict`
135+
- `Conflicted/True/HostnameConflict`
134136
- `Conflicted/False/NoConflicts`
135137

136138
---
@@ -255,10 +257,38 @@ Fields:
255257

256258
{{< bootstrap-table "table table-striped table-bordered" >}}
257259
| Resource | Core Support Level | Extended Support Level | Implementation-Specific Support Level | API Version |
258-
| -------- | ------------------ | ---------------------- | ------------------------------------- | ----------- |
259-
| TLSRoute | Not supported | Not supported | Not supported | N/A |
260+
|----------|--------------------|------------------------|---------------------------------------|-------------|
261+
| TLSRoute | Supported | Not supported | Not supported | v1alpha2 |
260262
{{< /bootstrap-table >}}
261263

264+
**Fields**:
265+
266+
- `spec`
267+
- `parentRefs`: Partially supported. Port not supported.
268+
- `hostnames`: Supported.
269+
- `rules`
270+
- `backendRefs`: Partially supported. Only one backend ref allowed.
271+
- `weight`: Not supported.
272+
- `status`
273+
- `parents`
274+
- `parentRef`: Supported.
275+
- `controllerName`: Supported.
276+
- `conditions`: Supported (Condition/Status/Reason):
277+
- `Accepted/True/Accepted`
278+
- `Accepted/False/NoMatchingListenerHostname`
279+
- `Accepted/False/NoMatchingParent`
280+
- `Accepted/False/NotAllowedByListeners`
281+
- `Accepted/False/UnsupportedValue`: Custom reason for when the TLSRoute includes an invalid or unsupported value.
282+
- `Accepted/False/InvalidListener`: Custom reason for when the TLSRoute references an invalid listener.
283+
- `Accepted/False/GatewayNotProgrammed`: Custom reason for when the Gateway is not Programmed. TLSRoute can be valid and configured, but will maintain this status as long as the Gateway is not Programmed.
284+
- `Accepted/False/HostnameConflict`: Custom reason for when the TLSRoute has a hostname that conflicts with another TLSRoute on the same port.
285+
- `ResolvedRefs/True/ResolvedRefs`
286+
- `ResolvedRefs/False/InvalidKind`
287+
- `ResolvedRefs/False/RefNotPermitted`
288+
- `ResolvedRefs/False/BackendNotFound`
289+
- `ResolvedRefs/False/UnsupportedValue`: Custom reason for when one of the TLSRoute rules has a backendRef with an unsupported value.
290+
- `PartiallyInvalid/True/UnsupportedValue`
291+
262292
---
263293

264294
### TCPRoute

site/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/nginxinc/nginx-gateway-fabric/site
22

33
go 1.21
44

5-
require github.com/nginxinc/nginx-hugo-theme v0.41.0 // indirect
5+
require github.com/nginxinc/nginx-hugo-theme v0.41.1 // indirect

site/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
github.com/nginxinc/nginx-hugo-theme v0.41.0 h1:uB9jC0Qk9i2CG63gScHxVHAEz1zyGoAdtY0Lcpkg1lI=
22
github.com/nginxinc/nginx-hugo-theme v0.41.0/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
3+
github.com/nginxinc/nginx-hugo-theme v0.41.1 h1:Wan0Mb8uz1X4Z2vd/1nR0GOPel5mWVPuFD3jd4SezsU=
4+
github.com/nginxinc/nginx-hugo-theme v0.41.1/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=

0 commit comments

Comments
 (0)