Skip to content

Commit 73cd13e

Browse files
rgee0alexellis
authored andcommitted
Replace underscores in secret names with hyphens
Kubernetes has a naming constaint which means that the patterm must fit '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'. This change replaces the underscores in the secret names so the examples are functional on both Docker and Kubernetes. Signed-off-by: rgee0 <[email protected]>
1 parent cd24d6b commit 73cd13e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/reference/secrets.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ In Kubernetes we can leverage the [secrets api](https://kubernetes.io/docs/conce
2121
From the commandline use
2222

2323
```sh
24-
kubectl create secret generic secret_api_key --from-file=secret_api_key=~/secrets/secret_api_key.txt
24+
kubectl create secret generic secret-api-key --from-file=secret-api-key=~/secrets/secret_api_key.txt
2525
```
2626

27-
Here we have explicitly named the key of the secret value so that when it is mounted into the function container, it will be named exactly `secret_api_key` instead of `secret_api_key.txt`.
27+
Here we have explicitly named the key of the secret value so that when it is mounted into the function container, it will be named exactly `secret-api-key` instead of `secret_api_key.txt`.
2828

2929
### Define a secret in Docker Swarm
3030

@@ -33,7 +33,7 @@ For sensitive value we can leverage the [Docker Swarm Secrets](https://docs.dock
3333
From the command line use
3434

3535
```sh
36-
docker secret create secret_api_key ~/secrets/secret_api_key.txt
36+
docker secret create secret-api-key ~/secrets/secret_api_key.txt
3737
```
3838

3939
## Use the secret in your function
@@ -51,7 +51,7 @@ Now, update your stack file to include the secret:
5151
skip_build: true
5252
image: functions/api-key-protected:latest
5353
secrets:
54-
- secret_api_key
54+
- secret-api-key
5555
```
5656
5757
and then deploy `faas-cli deploy -f ./stack.yaml`

0 commit comments

Comments
 (0)