Skip to content

Commit fe2dbef

Browse files
committed
Replace ingress-nginx references with Traefik
Update documentation across multiple pages to recommend Traefik as the default ingress controller instead of ingress-nginx: - Switch ingress controller references from nginx to Traefik - Update installation commands to use arkade install traefik2 - Replace nginx-specific annotations with Traefik equivalents - Update ingressClassName from nginx to traefik - Add Traefik timeout configuration guide Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
1 parent 2b1576a commit fe2dbef

File tree

5 files changed

+67
-50
lines changed

5 files changed

+67
-50
lines changed

docs/architecture/production.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ Whether you need to configure new networking for your OpenFaaS deployments, or i
193193

194194
It is recommended that you use an IngressController and TLS so that traffic between your clients and your OpenFaaS Gateway is encrypted.
195195

196-
You may already have opinions about what IngressController you want to use, the maintainers like to use Nginx given its broad adoption and relative ubiquity.
197-
198-
> See also: [Nginx IngressController](https://github.com/kubernetes/ingress-nginx)
196+
> See also: [Traefik Proxy](https://doc.traefik.io/traefik/)
199197

200198
Heptio Contour also includes automatic retries and additional Ingress extensions which you may find useful:
201199

docs/deployment/kubernetes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ There are three recommended ways to install OpenFaaS and you can pick whatever m
7474

7575
#### 1) Deploy the Chart with `arkade` (fastest option)
7676

77-
The `arkade install` command installs OpenFaaS using its official helm chart. arkade can also install other important software for OpenFaaS users such as `cert-manager` and `nginx-ingress`. It's the easiest and quickest way to get up and running.
77+
The `arkade install` command installs OpenFaaS using its official helm chart. arkade can also install other important software for OpenFaaS users such as `cert-manager` and `traefik`. It's the easiest and quickest way to get up and running.
7878

7979
You can use [arkade](https://arkade.dev/) to install OpenFaaS to a regular cloud cluster, your laptop, a VM, a Raspberry Pi, or a 64-bit Arm machine.
8080

@@ -197,7 +197,7 @@ Also, ensure any [default load-balancer timeouts within GKE](https://cloud.googl
197197
To enable TLS while using Helm, try one of the following references:
198198

199199
* [Get TLS for OpenFaaS the easy way with arkade](https://blog.alexellis.io/tls-the-easy-way-with-openfaas-and-k3sup/)
200-
* [Configure TLS with nginx-ingress and cert-manager](/reference/tls-openfaas)
200+
* [Configure TLS with Traefik and cert-manager](/reference/tls-openfaas)
201201

202202
### Setting an Image Pull Policy for your functions
203203

docs/reference/tls-openfaas.md

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## TLS for OpenFaaS
1+
# TLS for OpenFaaS
22

33
Transport Layer Security (TLS) is a cryptographic protocol that provides secure encryption on top of HTTP. It is required for any OpenFaaS gateway which is exposed to the Internet.
44

@@ -8,62 +8,69 @@ This guide explains how to obtain TLS certificates for the OpenFaaS Gateway runn
88
* Configure cert-manager to obtain a certificate from Let's Encrypt
99
* Configure the an Ingress record for the OpenFaaS Gateway
1010

11-
### Pre-requisites
11+
## Pre-requisites
1212

1313
* A domain name under your control, and access to create A or CNAME records
1414
* A public IP address with NodePorts, a Load Balancer or a tunnel such as [inlets](https://inlets.dev/)
1515
* A Kubernetes cluster
1616

1717
Where you see `example.com` given in an example, replace that with your own domain name.
1818

19-
### Make sure you can obtain public IP addresses
19+
## Make sure you can obtain public IP addresses
2020

2121
Managed Kubernetes services have a built-in LoadBalancer provisioner, which will provide a public IP address or CNAME for you, once you create a Service of type LoadBalancer.
2222

2323
If you're running self-managed Kubernetes, where each node has its own Public IP address, then you can configure your Ingress Controller to use a NodePort mapped to port 80 and 443 on the host.
2424

2525
If you are running on a local or private network, you can use [inlets-operator](https://github.com/inlets/inlets-operator) instead, which provisions a VM and uses its public IP address over a websocket tunnel.
2626

27-
### Set up an Ingress Controller
27+
## Set up an Ingress Controller
2828

29-
We recommend ingress-nginx for OpenFaaS, however any Ingress controller will work, or you can use Istio with separate instructions.
29+
We recommend Traefik for OpenFaaS, however any Ingress controller will work, or you can use Istio with separate instructions.
3030

31-
To install ingress-nginx, use either the Helm chart, or arkade:
31+
Install Traefik with Helm:
3232

3333
```sh
34-
$ arkade install ingress-nginx
35-
```
34+
helm repo add traefik https://traefik.github.io/charts
35+
helm repo update
3636

37-
See also: [ingress-nginx installation](https://kubernetes.github.io/ingress-nginx/deploy/)
37+
helm install --namespace=traefik traefik traefik/traefik \
38+
--create-namespace
39+
```
3840

41+
See also: [Traefik installation](https://doc.traefik.io/traefik/getting-started/install-traefik/)
3942

40-
#### Timeouts for synchronous invocations
43+
### Timeouts for synchronous invocations
4144

4245
Despite configuring OpenFaaS and your functions for [extended timeouts](/tutorials/expanded-timeouts.md), you may find that your Ingress Controller, Istio Gateway, or Cloud Load Balancer implements its own timeouts on connections. If you think you have everything configured correctly for OpenFaaS, but see a timeout at a very specific number such as 30s or 60s, then check the timeouts on your Ingress Controller or Load Balancer.
4346

44-
For Ingress Nginx, to extend a synchronous invocation beyond one minute, add the `nginx.ingress.kubernetes.io/proxy-read-timeout` annotation to your Ingress resource. This annotation is specified in seconds - for example, to extend the timeout to 30 minutes, use `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`.
47+
For Traefik, timeouts are typically configured at the EntryPoint level in the static configuration. See the [expanded timeouts guide](/tutorials/expanded-timeouts.md#load-balancers-ingress-and-service-meshes) for more details on configuring Traefik timeouts.
48+
49+
Ingress Nginx is now a retired project and should not be used for new installations. If you are still using Ingress Nginx, to extend a synchronous invocation beyond one minute, add the `nginx.ingress.kubernetes.io/proxy-read-timeout` annotation to your Ingress resource. This annotation is specified in seconds - for example, to extend the timeout to 30 minutes, use `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`.
4550

46-
### Install cert-manager
51+
## Install cert-manager
4752

4853
cert-manager is a Kubernetes operator maintained by the Cloud Native Computing Foundation (CNCF) which automates TLS certificate management.
4954

50-
To install cert-manager, use either the Helm chart, or arkade:
55+
To install cert-manager:
5156

5257
```sh
53-
$ arkade install cert-manager
58+
helm install \
59+
cert-manager oci://quay.io/jetstack/charts/cert-manager \
60+
--namespace cert-manager \
61+
--create-namespace \
62+
--set crds.enabled=true
5463
```
5564

5665
See also: [cert-manager installation](https://cert-manager.io/docs/installation/)
5766

58-
### Configure cert-manager
67+
## Configure cert-manager
5968

6069
You'll need to create an Issuer or ClusterIssuer for your cert-manager installation. This will tell cert-manager which domain it is operating on, and how to register an account for you.
6170

6271
The below will create an Issuer that only operates in the openfaas namespace, with a HTTP01 challenge. Note the ingress class specified in the HTTP01 challenge, this should match the class of your Ingress controller. You can view ingress classes with `kubectl get ingressclass`.
6372

6473
```bash
65-
export EMAIL="you@example.com"
66-
6774
cat > issuer.yaml <<EOF
6875
apiVersion: cert-manager.io/v1
6976
kind: Issuer
@@ -73,14 +80,13 @@ metadata:
7380
spec:
7481
acme:
7582
server: https://acme-v02.api.letsencrypt.org/directory
76-
email: $EMAIL
7783
privateKeySecretRef:
7884
name: letsencrypt
7985
solvers:
8086
- selector: {}
8187
http01:
8288
ingress:
83-
class: nginx
89+
class: traefik
8490
---
8591
apiVersion: cert-manager.io/v1
8692
kind: Issuer
@@ -90,14 +96,13 @@ metadata:
9096
spec:
9197
acme:
9298
server: https://acme-staging-v02.api.letsencrypt.org/directory
93-
email: $EMAIL
9499
privateKeySecretRef:
95100
name: letsencrypt-staging
96101
solvers:
97102
- selector: {}
98103
http01:
99104
ingress:
100-
class: nginx
105+
class: traefik
101106
---
102107
103108
EOF
@@ -109,38 +114,37 @@ Apply the staging and production Issuers:
109114
$ kubectl apply -f issuer.yaml
110115
```
111116

112-
### Create the required DNS records
117+
## Create the required DNS records
113118

114119
You will need to create an A or CNAME record for your domain, pointing to the public IP address of your Ingress controller.
115120

116-
If you created the Ingress Controller with arkade, you'll see a new service in the default namespace called `ingress-nginx-controller`. You can find the public IP address with:
121+
After installing Traefik, you'll see a new LoadBalancer service for traefik in the `traefik namespace. You can find the public IP address with:
117122

118123
```sh
119-
$ kubectl get svc -n default ingress-nginx-controller
124+
$ kubectl get svc/traefik -n traefik
120125

121-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
122-
ingress-nginx-controller LoadBalancer 10.43.87.4 18.136.136.18 80:31876/TCP,443:30108/TCP 28d
126+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
127+
traefik LoadBalancer 10.43.87.4 18.136.136.18 80:31876/TCP,443:31706/TCP 28d
123128
```
124129

125-
Take the IP address from the `EXTERNAL-IP` column and create an A record for your domain in your domain management software, or a CNAME record if you're using AWS EKS, and see a domain name in this field.
130+
Take the IP address from the `EXTERNAL-IP` column and create an A record for your domain in your domain management software, or a CNAME record if you see a domain name in this field.
126131

127132
All users should create an entry for: `gateway.example.com` and then OpenFaaS dashboard users should create an additional record pointing at the same address for: `dashboard.example.com`.
128133

129-
### Configure TLS for the OpenFaaS gateway
134+
## Configure TLS for the OpenFaaS gateway
130135

131136
You can now configure the OpenFaaS gateway to use TLS by setting the following Helm values, you can save them in a file called `tls.yaml`:
132-
137+
133138
```sh
134139
export DOMAIN="gw.example.com"
135-
export NGINX_TIMEOUT_SECS="1800" # 30 minutes
136140

137141
cat > tls.yaml <<EOF
138142
ingress:
139143
enabled: true
140-
ingressClassName: nginx
144+
ingressClassName: traefik
141145
annotations:
142146
cert-manager.io/issuer: letsencrypt-prod
143-
nginx.ingress.kubernetes.io/proxy-read-timeout: "$NGINX_TIMEOUT_SECS"
147+
traefik.ingress.kubernetes.io/router.entrypoints: websecure
144148
tls:
145149
- hosts:
146150
- $DOMAIN
@@ -159,10 +163,12 @@ ingress:
159163
EOF
160164
```
161165

162-
If you're using something other than ingress-nginx, then change the `ingressClassName` field accordingly. Note that the `kubernetes.io/ingress.class` annotation is deprecated and should not be used.
166+
If you're using something other than Traefik, then change the `ingressClassName` field accordingly. Note that the `kubernetes.io/ingress.class` annotation is deprecated and should not be used.
163167

164168
The `cert-manager.io/issuer` annotation is used to pick between the staging and production Issuers for Let's Encrypt. If this is your first time working with cert-manager, you may want to use the staging issuer first to avoid running into rate limits if you have something misconfigured.
165169

170+
> Note: For extended timeouts beyond Traefik's defaults, see the [expanded timeouts guide](/tutorials/expanded-timeouts.md#load-balancers-ingress-and-service-meshes) for information on configuring Traefik's EntryPoint timeouts.
171+
166172
Now upgrade OpenFaaS via helm, use any custom values.yaml files that you have saved from a previous installation:
167173

168174
```sh
@@ -173,7 +179,7 @@ helm repo update && \
173179
--values values-custom.yaml
174180
```
175181

176-
### Configure TLS for the OpenFaaS dashboard
182+
## Configure TLS for the OpenFaaS dashboard
177183

178184
If you're using OpenFaaS Standard or OpenFaaS for Enterprises, you will probably want to create an additional Ingress record for the OpenFaaS dashboard.
179185

@@ -182,15 +188,14 @@ Edit the previous example:
182188
```sh
183189
export DOMAIN="gw.example.com"
184190
export DOMAIN_DASHBOARD="dashboard.example.com"
185-
export NGINX_TIMEOUT_SECS="1800" # 30 minutes
186191

187192
cat > tls.yaml <<EOF
188193
ingress:
189194
enabled: true
190-
ingressClassName: nginx
195+
ingressClassName: traefik
191196
annotations:
192197
cert-manager.io/issuer: letsencrypt-prod
193-
nginx.ingress.kubernetes.io/proxy-read-timeout: "$NGINX_TIMEOUT_SECS"
198+
traefik.ingress.kubernetes.io/router.entrypoints: websecure
194199
tls:
195200
- hosts:
196201
- $DOMAIN
@@ -224,7 +229,7 @@ EOF
224229

225230
As above, run the `helm upgrade` command to apply the changes.
226231

227-
### Verifying the installation
232+
## Verifying the installation
228233

229234
First, check that the DNS records you created have taken effect. You can use `nslookup` or `dig` to check that the domain names resolve to the public address of your Ingress Controller's service.
230235

docs/tutorials/expanded-timeouts.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,17 @@ AWS EKS is configured to use an [Elastic Load Balancer (ELB)](https://aws.amazon
9898

9999
Google Cloud's various Load Balancer options have their [own configuration options too](https://cloud.google.com/load-balancing/docs/https).
100100

101-
For Ingress Nginx, set the `nginx.ingress.kubernetes.io/proxy-read-timeout` annotation to extend the timeout. This annotation is specified in seconds - for example, to extend the timeout to 30 minutes, use `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`.
101+
For Traefik, see [Configuring Traefik timeouts](#configuring-traefik-timeouts) below.
102+
103+
Ingress Nginx is now a retired project and should not be used for new installations. If you are still using it, set the `nginx.ingress.kubernetes.io/proxy-read-timeout` annotation to extend the timeout. This annotation is specified in seconds - for example, to extend the timeout to 30 minutes, use `nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"`.
104+
105+
### Configuring Traefik timeouts
106+
107+
Traefik has two separate sets of timeouts to be aware of:
108+
109+
**Client-to-Traefik (EntryPoints)** - configured in the static configuration (CLI flags or Helm values). Controls how long Traefik waits for the client to send a request or receive a response. The key fields are `readTimeout` (default 60s), `writeTimeout` (default 0s) and `idleTimeout` (default 180s). See [EntryPoints - RespondingTimeouts](https://doc.traefik.io/traefik/routing/entrypoints/#respondingtimeouts).
110+
111+
**Traefik-to-App (ServersTransport)** - configured in the dynamic configuration using a [ServersTransport CRD](https://doc.traefik.io/traefik/reference/routing-configuration/kubernetes/crd/http/serverstransport/), and referenced via the `traefik.ingress.kubernetes.io/service.serverstransport` annotation on the Ingress. By default there is no timeout on how long Traefik waits for a backend to respond (`responseHeaderTimeout` is 0s). Consider setting `responseHeaderTimeout` to match the gateway's `upstreamTimeout` so that Traefik returns a 504 quickly when a function hangs, rather than waiting indefinitely.
102112

103113
Finally, if you need to invoke a function for longer than one of your infrastructure components allows, then you should use an [asynchronous invocation](/reference/async). Asynchronous function invocations bypass these components because they are eventually invoked from the queue-worker, not the Internet. The queue-worker for OpenFaaS Standard will also retry invocations if required.
104114

docs/tutorials/local-kind-ingress.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Most users will use port-forwarding to access the OpenFaaS gateway, it's the simplest option and works everywhere.
44

5-
However, in this tutorial, we will show you how to deploy OpenFaaS with ingress-nginx.
5+
However, in this tutorial, we will show you how to deploy OpenFaaS with Traefik ingress.
66

77
When you use an Ingress Controller:
88

@@ -53,14 +53,19 @@ EOF
5353
kind create cluster --name openfaas --config kind-config.yaml
5454
```
5555

56-
## Install the ingress-nginx IngressController
56+
## Install the Traefik IngressController
5757

58-
Use arkade, or [install ingress-nginx manually](https://kubernetes.github.io/ingress-nginx/deploy/).
58+
Install Traefik with Helm:
5959

6060
```sh
61-
arkade install ingress-nginx
61+
helm repo add traefik https://traefik.github.io/charts
62+
helm repo update
63+
helm install --namespace=traefik traefik traefik/traefik \
64+
--create-namespace
6265
```
6366

67+
See also: [Traefik installation](https://doc.traefik.io/traefik/getting-started/install-traefik/)
68+
6469
## Install OpenFaaS with local Ingress enabled
6570

6671
Usually, Ingress is used when a cluster has a public IP address, and you want to obtain TLS certificates from Let's Encrypt. In this case, we'll use it to access the OpenFaaS gateway on the host machine.
@@ -77,7 +82,7 @@ ingress:
7782
serviceName: gateway
7883
servicePort: 8080
7984
path: /
80-
ingressClassName: nginx
85+
ingressClassName: traefik
8186
```
8287
8388
> Note: if you're migrating from an older version of Kubernetes, the `annotations.kubernetes.io/ingress.class` [annotation is deprecated](https://kubernetes.io/docs/concepts/services-networking/ingress/#deprecated-annotation), use `ingressClassName` instead.
@@ -103,4 +108,3 @@ faas-cli store deploy env
103108
104109
faas-cli list
105110
```
106-

0 commit comments

Comments
 (0)