Skip to content

Commit e3977be

Browse files
committed
Add docs for NATS authorization
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent e236ae7 commit e3977be

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

docs/deployment/pro.md

+18
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ queueMode: jetstream
8686

8787
nats:
8888
streamReplication: 1
89+
authorization:
90+
enabled: true
8991
```
9092
9193
You can find explanations for each configuration item in the [values-pro.yaml](https://github.com/openfaas/faas-netes/blob/master/chart/openfaas/values-pro.yaml) file on GitHub.
@@ -105,6 +107,22 @@ kubectl create secret generic \
105107
--from-file license=$HOME/.openfaas/LICENSE
106108
```
107109

110+
The recommended values.yaml file enables NATS authentication. If you are upgrading from OpenFaaS CE or enabling NATS authentication for the first time on an existing installation an authorization token secret should be created.
111+
112+
If this is your first time installing OpenFaaS Pro you can ignore this step. The Helm Chart will generate the secret automatically.
113+
114+
Create a secret for the NATS authorization token:
115+
116+
```sh
117+
# openssl is preferred to generate a random secret:
118+
openssl rand -base64 32 > ./nats-token
119+
120+
kubectl create secret generic \
121+
-n openfaas \
122+
nats-token \
123+
--from-file token=./nats-token
124+
```
125+
108126
Add the OpenFaaS helm chart repo:
109127

110128
```sh

docs/openfaas-pro/jetstream.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To enable JetSteam for OpenFaaS set `jetstream` as the queue mode in the values.
4141
```yaml
4242
queueMode: jetstream
4343
nats:
44-
streamReplication: 1
44+
streamReplication: 1
4545
```
4646
4747
If the NATS pod restarts, you will lose all messages that it contains. In your development or staging environment, this shouldn't happen very often.
@@ -58,6 +58,38 @@ nats:
5858
port: "4222"
5959
```
6060
61+
## NATS Authentication
62+
63+
We recommend enabling authentication for NATS to limit the access to the NATS server.
64+
65+
To enable authorization for NATS add the following to `nats` section in your values.yaml file.
66+
67+
```yaml
68+
nats:
69+
authorization:
70+
enabled: true
71+
# Generate the NATS authorization token on first installation.
72+
generateToken: true
73+
```
74+
75+
A Helm Chart `pre-install` hook is used to generate an access token on first installation. If you are upgrading an existing OpenFaaS installation or using an external NATS cluster you will need to create the token secret manually.
76+
77+
```sh
78+
# openssl is preferred to generate a random secret:
79+
openssl rand -base64 32 > ./nats-token
80+
81+
kubectl create secret generic \
82+
-n openfaas \
83+
nats-token \
84+
--from-file token=./nats-token
85+
```
86+
87+
Installations using an external NATS cluster should also set `nats.authorization.generateToken` to `false`. This prevents the Chart from overriding the secret on installation.
88+
89+
Use the `nats-token` value to configure the access token through the NATS helm chart if you are running an external NATS cluster.
90+
91+
Full instructions for external NATS are available in the [Customer Community](https://github.com/openfaas/customers/).
92+
6193
## Features
6294

6395
### Metrics and monitoring

0 commit comments

Comments
 (0)