From cf570ebea3b9d4db0d1ab04c4571ac87064c4e7e Mon Sep 17 00:00:00 2001 From: Sarthak Agrawal Date: Fri, 9 Aug 2024 14:58:09 -0600 Subject: [PATCH] Add guide for TLS Route in site Problem: Site did not have a guide for TLS Route Solution: I wrote a guide for it. --- .../tls-passthrough-routing.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 site/content/how-to/traffic-management/tls-passthrough-routing.md diff --git a/site/content/how-to/traffic-management/tls-passthrough-routing.md b/site/content/how-to/traffic-management/tls-passthrough-routing.md new file mode 100644 index 0000000000..1f24569057 --- /dev/null +++ b/site/content/how-to/traffic-management/tls-passthrough-routing.md @@ -0,0 +1,194 @@ +--- +title: "TLS Passthrough" +weight: 600 +toc: true +docs: "DOCS-1421" +--- + +Learn how to passthrough TLS connection using NGINX Gateway Fabric. + +## Overview + +In this guide, we will show how to configure TLS passthrough for your application, using a [TLSRoute](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1alpha2.TLSRoute). + +## Before you begin + +- [Install]({{< relref "installation/" >}}) NGINX Gateway Fabric. +- Save the public IP address and port of NGINX Gateway Fabric into shell variables: + + ```text + GW_IP=XXX.YYY.ZZZ.III + GW_PORT= + ``` + + Save the ports of NGINX Gateway Fabric: + + ```text + GW_HTTP_PORT= + GW_HTTPS_PORT= + ``` + +{{< 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 >}} + +Create the tls-backend application by copying and pasting the following block into your terminal: + +```yaml +kubectl apply -f - < 8443/TCP 12s +``` + +Next, let's create a gateway. This will create TLS listener with the hostname *.example.com. Copy paste this into your terminal. + +```yaml +kubectl apply -f - <}}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 >}} + +To test that NGINX sends an HTTPS redirect, we will send requests to the `secure-app` service on the HTTPS port. + +```shell +curl --resolve cafe.example.com:$GW_PORT:$GW_IP https://cafe.example.com:$GW_PORT --insecure +``` + +```text +hello from pod secure-app-575785644-kzqf6 +```