Skip to content

Commit 339917b

Browse files
committed
Use docs for setting up TLS for the gateway and dashboard
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 6b536db commit 339917b

1 file changed

Lines changed: 8 additions & 129 deletions

File tree

_posts/2023-06-20-walkthrough-iam-for-openfaas.md

Lines changed: 8 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -97,134 +97,11 @@ Add the OpenFaaS helm chart repo:
9797
helm repo add openfaas https://openfaas.github.io/faas-netes/
9898
```
9999

100-
Configure ingress to make the OpenFaaS gateway and dashboard accessible to the users.
100+
Follow the instructions below to set up TLS for the gateway and the dashboard using certificates from Let's Encrypt:
101101

102-
You will need to create two DNS entries for the domains the gateway and dashboard will be exposed at. These can either be on the public internet or kept within the internal network.
102+
* [Setup TLS for OpenFaaS](https://docs.openfaas.com/reference/tls-openfaas)
103103

104-
The below instructions show how to set up Ingress with a TLS certificate using Ingress Nginx. You can also use any other ingress-controller, inlets-pro or an Istio Gateway.
105-
106-
Install [cert-manager](https://cert-manager.io/docs/), which is used to manage TLS certificates.
107-
108-
You can use Helm, or [arkade](https://github.com/alexellis/arkade):
109-
110-
```bash
111-
arkade install cert-manager
112-
```
113-
114-
Install ingress-nginx using arkade or Helm:
115-
116-
```bash
117-
arkade install ingress-nginx
118-
```
119-
120-
Istio, and other solutions for Ingress will also work in the same way.
121-
122-
Create an ACME certificate issuer:
123-
124-
```bash
125-
export EMAIL="mail@example.com"
126-
127-
cat > issuer-prod.yaml <<EOF
128-
apiVersion: cert-manager.io/v1
129-
kind: Issuer
130-
metadata:
131-
name: letsencrypt-prod
132-
namespace: openfaas
133-
spec:
134-
acme:
135-
server: https://acme-v02.api.letsencrypt.org/directory
136-
email: $EMAIL
137-
privateKeySecretRef:
138-
name: letsencrypt-prod
139-
solvers:
140-
- http01:
141-
ingress:
142-
class: nginx
143-
EOF
144-
```
145-
146-
```bash
147-
kubectl apply -f issuer-prod.yaml
148-
```
149-
150-
Create an ingress record for the gateway:
151-
152-
```bash
153-
export DOMAIN="gateway.openfaas.example.com"
154-
155-
cat > gateway-ingress.yaml <<EOF
156-
apiVersion: networking.k8s.io/v1
157-
kind: Ingress
158-
metadata:
159-
annotations:
160-
cert-manager.io/issuer: letsencrypt-prod
161-
kubernetes.io/ingress.class: nginx
162-
labels:
163-
app: gateway
164-
name: gateway
165-
namespace: openfaas
166-
spec:
167-
rules:
168-
- host: $DOMAIN
169-
http:
170-
paths:
171-
- backend:
172-
service:
173-
name: gateway
174-
port:
175-
number: 8080
176-
path: /
177-
pathType: Prefix
178-
tls:
179-
- hosts:
180-
- $DOMAIN
181-
secretName: gateway-cert
182-
EOF
183-
```
184-
185-
```bash
186-
kubectl apply -f gateway-ingress.yaml
187-
```
188-
Create an ingress record for the dashboard:
189-
190-
```bash
191-
export DOMAIN="dashboard.openfaas.example.com"
192-
193-
cat > dashboard-ingress.yaml <<EOF
194-
apiVersion: networking.k8s.io/v1
195-
kind: Ingress
196-
metadata:
197-
name: openfaas-dashboard
198-
namespace: openfaas
199-
labels:
200-
app: openfaas-dashboard
201-
annotations:
202-
cert-manager.io/issuer: letsencrypt-prod
203-
kubernetes.io/tls-acme: "true"
204-
nginx.ingress.kubernetes.io/ssl-redirect: "true"
205-
kubernetes.io/ingress.class: nginx
206-
spec:
207-
rules:
208-
- host: $DOMAIN
209-
http:
210-
paths:
211-
- backend:
212-
service:
213-
name: dashboard
214-
port:
215-
number: 8080
216-
path: /
217-
pathType: Prefix
218-
tls:
219-
- hosts:
220-
- $DOMAIN
221-
secretName: dashboard-cert
222-
EOF
223-
```
224-
225-
```bash
226-
kubectl apply -f dashboard-ingress.yaml
227-
```
104+
Whilst following these instructions, you'll create a `tls.yaml` file, which will be added to the `helm upgrade` command.
228105

229106
Create a signing key for the OpenFaaS issuer. It is used by the OIDC plugin to sign access tokens issued by OpenFaaS.
230107

@@ -275,7 +152,8 @@ helm repo update \
275152
&& helm upgrade openfaas \
276153
--install openfaas/openfaas \
277154
--namespace openfaas \
278-
-f values-iam.yaml
155+
-f values-iam.yaml \
156+
-f tls.yaml
279157
```
280158

281159
As part of OpenFaaS for Enterprises we'll be enabling [multi namespace for functions](https://docs.openfaas.com/reference/namespaces/). Multiple namespaces can be used for logical separation between stages like dev, staging and production or for various teams or tenants.
@@ -503,8 +381,9 @@ Update the OpenFaaS deployment:
503381
```bash
504382
helm upgrade openfaas \
505383
--install openfaas/openfaas \
506-
--namespace openfaas \
507-
-f values-iam.yaml
384+
--namespace openfaas \
385+
-f values-iam.yaml \
386+
-f tls.yaml
508387
```
509388

510389
### Authenticate with the faas-cli

0 commit comments

Comments
 (0)