Skip to content

Commit 8acb1f3

Browse files
committed
Updates about Ingress for inlets-uplink
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 4d046f7 commit 8acb1f3

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

docs/uplink/ingress-for-tunnels.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55
Inlets Uplink is designed to connect customer services to a remote Kubernetes cluster for command and control as part of a SaaS product.
66

7-
Any tunnelled service can be accessed directly from within the cluster and does not need to be exposed to the public Internet for access.
7+
Any tunnelled service can be accessed directly from within the cluster using a ClusterIP Service and does not need to be exposed to the public Internet in order to be used by a SaaS product.
88

9-
Beware: by following these instructions, you are exposing one or more of those tunnels to the public Internet.
9+
Each inlets uplink tunnel is provisioned with a ClusterIP service that you can access internally within the cluster. The same service can be used to expose the tunnel to the public Internet using an Ingress resource. This approach is recommended for new users for dozens of tunnels.
1010

11+
Alternatively, the data-router component can be used along with a wild-card DNS reocrd and TLS certificate to expose many tunnels with a single Ingress record or Istio Gateway. This approach requires additional setup because the DNS01 challenge requires a special cert-manager Issuer with a secret for the DNS provider's API. It is recommended for users with many tunnels, but is more complex to setup.
1112

12-
Make inlets uplink HTTP tunnels publicly accessible by setting up ingress for the data plane.
13+
## Quick start
1314

1415
The instructions assume that you want to expose two HTTP tunnels. We will configure ingress for the first tunnel, called `grafana`, on the domain `grafana.example.com`. The second tunnel, called `openfaas`, will use the domain `openfaas.example.com`.
1516

16-
Both tunnels can be created with `kubectl` or the `inlets-pro` cli. See [create tunnels](/uplink/create-tunnels/) for more info:
17+
Both tunnels can be created with `kubectl` using the Custom Resource Definition, the `inlets-pro` CLI, or the [REST API](/uplink/rest-api/). See [create tunnels](/uplink/create-tunnels/) for more info:
1718

1819
=== "kubectl"
1920

@@ -53,7 +54,7 @@ Both tunnels can be created with `kubectl` or the `inlets-pro` cli. See [create
5354

5455
Follow the instruction for Kubernetes Ingress or Istio depending on how you deployed inlets uplink.
5556

56-
## Setup tunnel ingress
57+
## Expose the Tunnel with Ingress
5758

5859
1. Create a new certificate Issuer for tunnels:
5960

@@ -86,7 +87,7 @@ Follow the instruction for Kubernetes Ingress or Istio depending on how you depl
8687
kind: Ingress
8788
metadata:
8889
name: grafana-tunnel-ingress
89-
namespace: inlets
90+
namespace: tunnels
9091
annotations:
9192
kubernetes.io/ingress.class: nginx
9293
cert-manager.io/issuer: tunnels-letsencrypt-prod
@@ -99,7 +100,7 @@ Follow the instruction for Kubernetes Ingress or Istio depending on how you depl
99100
pathType: Prefix
100101
backend:
101102
service:
102-
name: grafana.tunnels
103+
name: grafana
103104
port:
104105
number: 8000
105106
tls:
@@ -110,14 +111,14 @@ Follow the instruction for Kubernetes Ingress or Istio depending on how you depl
110111
111112
Note that the annotation `cert-manager.io/issuer` is used to reference the certificate issuer created in the first step.
112113
113-
To setup ingress for multiple tunnels simply define multiple ingress resources. For example apply a second ingress resource for the openfaas tunnel:
114+
To setup ingress for multiple tunnels simply define multiple ingress resources. For example, you could create a second ingress resource for the openfaas tunnel:
114115
115116
```yaml
116117
apiVersion: networking.k8s.io/v1
117118
kind: Ingress
118119
metadata:
119120
name: openfaas-tunnel-ingress
120-
namespace: inlets
121+
namespace: tunnels
121122
annotations:
122123
kubernetes.io/ingress.class: nginx
123124
cert-manager.io/issuer: tunnels-letsencrypt-prod
@@ -130,7 +131,7 @@ spec:
130131
pathType: Prefix
131132
backend:
132133
service:
133-
name: openfaas.tunnels
134+
name: openfaas
134135
port:
135136
number: 8000
136137
tls:
@@ -139,8 +140,7 @@ spec:
139140
secretName: openfaas-cert
140141
```
141142
142-
143-
## Setup tunnel ingress with an Istio Ingress gateway
143+
## Expose the Tunnel with an Istio Ingress Gateway
144144
145145
1. Create a new certificate Issuer for tunnels:
146146
@@ -203,10 +203,10 @@ spec:
203203
204204
Note that both the certificates and issuer are created in the `istio-system` namespace.
205205
206-
3. Configure the ingress gateway for both tunnels. In this case we create a single resource for both hosts but you could also split the configuration into multiple Gateway resources.
206+
3. Configure the Ingress Gateway for both tunnels. In this case we create a single resource for both hosts but you could also split the configuration into multiple Gateway resources.
207207
208208
```yaml
209-
apiVersion: networking.istio.io/v1alpha3
209+
apiVersion: networking.istio.io/v1
210210
kind: Gateway
211211
metadata:
212212
name: tunnel-gateway
@@ -240,7 +240,7 @@ spec:
240240
4. Configure the gateway's traffic routes by defining corresponding virtual services:
241241
242242
```yaml
243-
apiVersion: networking.istio.io/v1alpha3
243+
apiVersion: networking.istio.io/v1
244244
kind: VirtualService
245245
metadata:
246246
name: grafana
@@ -260,7 +260,7 @@ spec:
260260
port:
261261
number: 8000
262262
---
263-
apiVersion: networking.istio.io/v1alpha3
263+
apiVersion: networking.istio.io/v1
264264
kind: VirtualService
265265
metadata:
266266
name: openfaas
@@ -287,7 +287,7 @@ After applying these resources you should be able to access the data plane for b
287287
288288
As an alternative to creating individual sets of Ingress records, DNS A/CNAME entries and TLS certificates for each tunnel, you can use the `data-router` to route traffic to the correct tunnel based on the hostname. This approach uses a wildcard DNS entry and a single TLS certificate for all tunnels.
289289
290-
The following example is adapted from the cert-manager documentation to use DigitalOcean's DNS servers, however you can find [instructions for issuers](https://cert-manager.io/docs/configuration/acme/dns01/) such as AWS Route53, Cloudflare, and Google Cloud DNS listed.
290+
The following example is adapted from the cert-manager documentation to use DigitalOcean's DNS servers, however you can find [instructions for issuers](https://cert-manager.io/docs/configuration/acme/dns01/) such as AWS Route53, Cloudflare, Google Cloud DNS, and AzureDNS being listed.
291291
292292
DNS01 challenges require a secret to be created containing the credentials for the DNS provider. The secret is referenced by the issuer resource.
293293
@@ -297,12 +297,12 @@ kubectl create secret generic \
297297
--from-file access-token=$HOME/do-access-token
298298
```
299299
300-
Create a separate `Issuer`, assuming a domain of `t.example.com`, where each tunnel would be i.e. `prometheus.t.example.com` or `api.t.example.com`:
300+
Create a separate `Issuer`, assuming a domain of `uplink.example.com`, where each tunnel would be i.e. `prometheus.uplink.example.com` or `api.uplink.example.com`:
301301
302302
```bash
303303
export NS="inlets"
304304
export ISSUER_NAME="inlets-wildcard"
305-
export DOMAIN="t.example.com"
305+
export DOMAIN="uplink.example.com"
306306
307307
cat <<EOF | kubectl apply -f -
308308
apiVersion: cert-manager.io/v1
@@ -333,8 +333,8 @@ Update values.yaml to enable the dataRouter and to specify the wildcard domain:
333333
dataRouter:
334334
enabled: true
335335
336-
# Leave out the asterix i.e. *.t.example.com would be: t.example.com
337-
wildcardDomain: "t.example.com"
336+
# Leave out the asterix i.e. *.uplink.example.com would be: uplink.example.com
337+
wildcardDomain: "uplink.example.com"
338338
339339
tls:
340340
issuerName: "inlets-wildcard"
@@ -360,7 +360,7 @@ Create a tunnel with an Ingress Domain specified in the `.Spec` field:
360360
361361
```bash
362362
export TUNNEL_NS="tunnels"
363-
export DOMAIN="t.example.com"
363+
export DOMAIN="uplink.example.com"
364364
365365
cat <<EOF | kubectl apply -f -
366366
apiVersion: uplink.inlets.dev/v1alpha1
@@ -401,18 +401,18 @@ inlets-pro tunnel connect fileshare \
401401
--domain $UPLINK_DOMAIN
402402
```
403403
404-
Add the `--upstream fileshare.t.example.com=fileshare` flag to the command you were given, then run it.
404+
Add the `--upstream fileshare.uplink.example.com=fileshare` flag to the command you were given, then run it.
405405
406406
The command below is sample output, do not copy it directly.
407407
408408
```bash
409409
inlets-pro uplink client \
410410
--url=wss://uplink.example.com/tunnels/fileshare \
411411
--token=REDACTED \
412-
--upstream fileshare.t.example.com=http://127.0.0.1:8080
412+
--upstream fileshare.uplink.example.com=http://127.0.0.1:8080
413413
```
414414
415-
Now, access the tunneled service via the wildcard domain i.e. `https://fileshare.t.example.com`.
415+
Now, access the tunneled service via the wildcard domain i.e. `https://fileshare.uplink.example.com`.
416416
417417
You should see: "Hello from inlets" printed in your browser.
418418
@@ -425,10 +425,10 @@ kubectl logs -n inlets deploy/data-router
425425
426426
2024-01-24T11:29:16.970Z info data-router/main.go:90 Listening on: 8080 Tunnel namespace: (all) Kubernetes version: v1.27.4+k3s1
427427
428-
I0124 11:29:58.858772 1 main.go:151] Host: fileshares.t.example.com Path: /
429-
I0124 11:29:58.858877 1 roundtripper.go:48] "No ingress found" hostname="fileshares.t.example.com" path="/"
428+
I0124 11:29:58.858772 1 main.go:151] Host: fileshares.uplink.example.com Path: /
429+
I0124 11:29:58.858877 1 roundtripper.go:48] "No ingress found" hostname="fileshares.uplink.example.com" path="/"
430430
431-
I0124 11:30:03.588993 1 main.go:151] Host: fileshare.t.example.com Path: /
432-
I0124 11:30:03.589051 1 roundtripper.go:56] "Resolved" hostname="fileshare.t.example.com" path="/" tunnel="fileshare.tunnels:8000"
431+
I0124 11:30:03.588993 1 main.go:151] Host: fileshare.uplink.example.com Path: /
432+
I0124 11:30:03.589051 1 roundtripper.go:56] "Resolved" hostname="fileshare.uplink.example.com" path="/" tunnel="fileshare.tunnels:8000"
433433
```
434434

0 commit comments

Comments
 (0)