Skip to content

Latest commit

 

History

History
108 lines (77 loc) · 2.75 KB

examples.md

File metadata and controls

108 lines (77 loc) · 2.75 KB

Lucario Background - transparent

Highlighting: Auto Drop shadow: off

https://carbon.now.sh

CLI example

# Set a shared auth token
$ export AUTH=""

# Setup a server in TCP mode
$ inlets-pro tcp server --auto-tls --auto-tls-san "178.62.70.130" \
  --token $AUTH

# Connect a client to provide upstream to 192.168.0.35 on the private
# network
$ inlets-pro tcp client --url wss://178.62.70.130:8123 \
  --token $AUTH \
  --upstream "192.168.0.35" \
  --ports "8080,2222"

# Use the tunnel for TCP traffic:
$ curl "http://178.62.70.130:8080/function/webhook"
$ ssh -p 2222 "[email protected]"

HTTPS example

# Setup a server in HTTPS mode
$ inlets-pro http server --auto-tls --auto-tls-san "178.62.70.130" \
  --letsencrypt-domain "api.example.com" \
  --letsencrypt-email "[email protected]" \
  --token $AUTH

# Connect a client and instruct the server which address to use 
# for each of the domains exposed
$ inlets-pro http client --url wss://178.62.70.130:8123 \
  --token $AUTH \
  --upstream "api.example.com=http://127.0.0.1:3000"

# Create a DNS record for the domain
$ doctl compute domain create api.example.com \
  --ip-address "178.62.70.130"

# Then access your website over the Internet with TLS
$ curl "https://api.example.com/v1/import"

Kubernetes example:

$ kubectl run nginx-1 --image=nginx --port=80 --restart=Always
pod/nginx-1 created

$ kubectl expose pod/nginx-1 --port=80 --type=LoadBalancer
service/nginx-1 exposed

# Install the operator with arkade or helm
$ arkade install inlets-operator \
  --provider digitalocean --region lon1 \
  --token-file "$HOME/do-token" \
  --license-file "$HOME/.inlets/LICENSE"

$ kubectl get svc/nginx-1 -w
NAME      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
nginx-1   LoadBalancer   10.100.115.125   <pending>     80:32200/TCP   2m26s
nginx-1   LoadBalancer   10.100.115.125   178.62.28.53  80:32200/TCP   2m36s

# Live LoadBalancer in 10 seconds!
$ curl -s "http://178.62.70.130:80/"

Uplink example:

bash

# Get the inlets uplink plugin
$ inlets-pro plugin get tunnel

# Create a new namespace for the customer
$ kubectl create ns customer1

# Create a tunnel for OpenFaaS for customer1
$ inlets-pro tunnel create openfaas --port 8080 --namespace customer1 
Created tunnel openfaas. OK.

$ inlets-pro tunnel connect openfaas --namespace customer1 --domain example.com
# Access your TCP tunnel via ClusterIP: openfaas.customer1:8080
  inlets-pro uplink client \
    --url="wss://uplink.example.com/customer1/openfaas" \
    --token="otFFiUzaViA6acvdWPnsbbCoEEs1yWCGnk3IU7tJo4laeQxA41dRy1qUhC"

# Access the customer service privately, from within the cluster
$ kubectl run -t -i curl --rm \
  --image ghcr.io/openfaas/curl:latest -- curl -s -i http://openfaas.customer1:8080