Skip to content

Commit 6ffaac6

Browse files
committed
Additional instructions for inlets-operator
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 425fb51 commit 6ffaac6

File tree

1 file changed

+87
-34
lines changed

1 file changed

+87
-34
lines changed

docs/reference/inlets-operator.md

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,125 @@ The [inlets/inlets-operator](https://github.com/inlets/inlets-operator) brings L
44

55
> It works by creating VMs and running an inlets Pro tunnel server for you, the VM's public IP is then attached to the cluster and an inlets client Pod runs for you.
66
7-
You can install the inlets-operator using a single command with [arkade](https://arkade.dev/) or with helm. arkade is an open-source Kubernetes marketplace and easier to use.
8-
97
For each provider, the minimum requirements tend to be:
108

119
* An access token - for the operator to create VMs for inlets Pro servers
1210
* A region - where to create the VMs
1311

12+
**Helm or Arkade?**
13+
14+
You can install the inlets-operator's Helm chart using a single command with [arkade](https://arkade.dev/). arkade is an open-source Kubernetes marketplace and easy to use. Helm involves more commands, and is preferred by power users.
15+
1416
> You can [subscribe to inlets for personal or commercial use via Gumroad](https://inlets.dev/blog/2021/07/27/monthly-subscription.html)
1517
16-
## Install using arkade
18+
## Tunnel Custom Resource Definition (CRD)
19+
20+
The inlets-operator uses a custom resource definition (CRD) to create tunnels. The CRD is called `Tunnel` and its full name is `tunnels.operator.inlets.dev`
21+
22+
```bash
23+
$ kubectl get tunnels -n default
24+
NAMESPACE NAME SERVICE HOSTSTATUS HOSTIP CREATED
25+
default nginx-1-tunnel nginx-1 active 46.101.1.67 2m45s
26+
```
27+
28+
The CRD can be used to view and monitor tunnels. The `HOSTSTATUS` field shows the status of the tunnel, and the `HOSTIP` field shows the public IP address of the tunnel.
29+
30+
The tunnel's IP address will also be written directly to any `Service` with a type of `LoadBalancer`.
31+
32+
```bash
33+
$ kubectl get svc -n default
34+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
35+
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 6m26s
36+
nginx-1 LoadBalancer 10.96.94.18 46.101.1.67,46.101.1.67 80:31194/TCP 4m21s
37+
```
38+
39+
The lifecycle of a tunnel is tied to the Service in Kubernetes.
40+
41+
To delete a tunnel permanently, you can delete the Service:
42+
43+
```bash
44+
kubectl delete svc nginx-1
45+
```
46+
47+
To have the tunnel server re-created, you can delete the tunnel CustomResource, this causes the operator to re-create the tunnel:
48+
49+
```bash
50+
kubectl delete tunnel nginx-1-tunnel
51+
```
52+
53+
### Working with another LoadBalancer
54+
55+
If you're running metal-lb or kube-vip to provide local IP addresses for LoadBalancer services, then you can annotate the services you wish to expose to the Internet with `operator.inlets.dev/manage=1`, then set `annotatedOnly: true` in the inlets-operator Helm chart.
56+
57+
## Install inlets-operator using arkade
1758

1859
```bash
60+
export REGION=lon1
61+
export PROVIDER=digitalocean
62+
1963
arkade install inlets-operator \
2064
--provider $PROVIDER \ # Name of the cloud provider to provision the exit-node on.
2165
--region $REGION \ # Used with cloud providers that require a region.
22-
--zone $ZONE \ # Used with cloud providers that require zone (e.g. gce).
23-
--token-file $HOME/Downloads/key.json # Token file/Service Account Key file with the access to the cloud provider.
66+
--token-file $HOME/Downloads/do-access-token.txt # Token file/Service Account Key file with the access to the cloud provider.
2467
```
2568

26-
## Install using helm
69+
## Install inlets-operator using helm
2770

28-
Checkout the inlets-operator helm chart [README](https://github.com/inlets/inlets-operator/blob/master/chart/inlets-operator/README.md) to know more about the values that can be passed to `--set` and to see provider specific example commands.
71+
The following instructions are a generic example, you should refer to each specific heading to understand how to create the required API keys for a given cloud provider.
2972

30-
```bash
31-
# Create a secret to store the service account key file
32-
kubectl create secret generic inlets-access-key \
33-
--from-file=inlets-access-key=key.json
73+
* Some providers require an access key, others also need a secret key.
74+
* Some providers only use a region, others use a zone and projectID too.
75+
* There are additional flags you can set via values.yaml or the `--set` flag.
3476

35-
# Add and update the inlets-operator helm repo
36-
helm repo add inlets https://inlets.github.io/inlets-operator/
77+
You can view the [inlets-operator chart on GitHub](https://github.com/inlets/inlets-operator/tree/master/chart/inlets-operator) to learn more.
3778

79+
```bash
3880
# Create a namespace for inlets-operator
3981
kubectl create namespace inlets
4082

83+
# Create a secret to store the service account key file
84+
kubectl create secret generic inlets-access-key \
85+
--namespace inlets \
86+
--from-file inlets-access-key=$HOME/Downloads/do-access-token.txt
87+
4188
# Create a secret to store the inlets-pro license
42-
kubectl create secret generic -n inlets \
89+
kubectl create secret generic \
90+
--namespace inlets \
4391
inlets-license --from-file license=$HOME/.inlets/LICENSE
4492

45-
# Update the local repository
46-
helm repo update
93+
# Add and update the inlets-operator helm repo
94+
# You only need to do this once.
95+
helm repo add inlets https://inlets.github.io/inlets-operator/
4796

48-
# Install inlets-operator with the required fields
49-
helm upgrade inlets-operator --install inlets/inlets-operator \
50-
--set provider=$PROJECTID,zone=$ZONE,region=$REGION \
51-
--set projectID=$PROJECTID \
52-
--set inletsProLicense=$LICENSE
53-
```
97+
export REGION=lon1
98+
export PROVIDER=digitalocean
5499

55-
View the code and chart on GitHub: [inlets/inlets-operator](https://github.com/inlets/inlets-operator)
100+
# Update the Helm repository and perform an installation
101+
helm repo update && \
102+
helm upgrade inlets-operator --install inlets/inlets-operator \
103+
--namespace inlets \
104+
--set provider=$PROVIDER \
105+
--set region=$REGION
106+
```
56107

57108
## Instructions per cloud
58109

59110
### Create tunnel servers on DigitalOcean
60111

61-
Install with inlets Pro on [DigitalOcean](https://m.do.co/c/8d4e75e9886f).
112+
The [DigitalOcean](https://m.do.co/c/8d4e75e9886f) provider is fast, cost effective and easy to set it. It's recommended for most users.
113+
114+
Create an API access token with full read/write permissions and save it to: `$HOME/Downloads/do-access-token.txt`.
62115

63-
Assuming you have created an API key and saved it to `$HOME/Downloads/do-access-token`, run:
116+
Now, install the chart with arkade using the above options:
64117

65118
```bash
66119
arkade install inlets-operator \
67120
--provider digitalocean \
68121
--region lon1 \
69-
--token-file $HOME/Downloads/do-access-token
122+
--token-file $HOME/Downloads/do-access-token.txt
70123
```
71124

72-
If you have `doctl` installed, you can list the available regions and see whether they have available capacity to launch a new VM.
125+
If you have the DigitalOcean CLI (`doctl`) installed, then you can use it to list available regions and their codes to input into the above command. Bear in mind that some regions are showing no availability for starting new VMs.
73126

74127
```bash
75128
doctl compute region ls
@@ -153,18 +206,18 @@ The below commands will create a set of credentials and save them into files for
153206
154207
```bash
155208
ACCESS_KEY_JSON=$(aws iam create-access-key --user-name inlets-automation)
156-
echo $ACCESS_KEY_JSON | jq -r .AccessKey.AccessKeyId > access-key
157-
echo $ACCESS_KEY_JSON | jq -r .AccessKey.SecretAccessKey > secret-access-key
209+
echo $ACCESS_KEY_JSON | jq -r .AccessKey.AccessKeyId > ~/Downloads/aws-access-key
210+
echo $ACCESS_KEY_JSON | jq -r .AccessKey.SecretAccessKey > ~/Downloads/aws-secret-access-key
158211
```
159212

160-
Install with inlets Pro:
213+
Install the chart with arkade using the above options:
161214

162215
```bash
163216
arkade install inlets-operator \
164217
--provider ec2 \
165218
--region eu-west-1 \
166-
--token-file $HOME/Downloads/access-key \
167-
--secret-key-file $HOME/Downloads/secret-access-key
219+
--token-file $HOME/Downloads/aws-access-key \
220+
--secret-key-file $HOME/Downloads/aws-secret-access-key
168221
```
169222

170223
### Create tunnel servers on Google Compute Engine (GCE)
@@ -202,7 +255,7 @@ gcloud iam service-accounts keys create key.json \
202255
--iam-account $SERVICEACCOUNT
203256
```
204257

205-
Install the operator:
258+
Install the chart with arkade using the above options:
206259

207260
```bash
208261
arkade install inlets-operator \
@@ -281,7 +334,7 @@ helm upgrade inlets-operator --install inlets/inlets-operator \
281334

282335
You can also install the inlets-operator using a single command using [arkade](https://arkade.dev/), arkade runs against any Kubernetes cluster.
283336

284-
Install with inlets Pro:
337+
Install the chart with arkade using the above options:
285338

286339
```bash
287340
arkade install inlets-operator \

0 commit comments

Comments
 (0)