Skip to content

Commit bc0025b

Browse files
committed
Adds notes on the security policy
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 11b7197 commit bc0025b

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

docs/reference/profiles.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The configuration use the exact options that you find in the Kubernetes document
8080

8181
#### Implement the restricted Pod Security Standard
8282

83-
This example requires OpenFaaS for Enterprises and is aimed at securing enterprise and multi-tenant workloads.
83+
This example requires OpenFaaS for Enterprises with (`faas-netes:0.5.65` or higher) and is aimed at securing enterprise and multi-tenant workloads.
8484

8585
[Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/) were introduced in K8s v1.25 and are a set of best practices for securing your Pods. The `restricted` profile is the most secure option.
8686

@@ -89,7 +89,7 @@ The below example deploys a function which will pass the `restricted` Pod Securi
8989
It defines:
9090

9191
* A new namespace for functions called `restricted-fn`, which has been labeled with `pod-security.kubernetes.io/enforce: restricted`
92-
* A new Profile called `restricted` which sets the Pod Security Context to use `RuntimeDefault` and `runAsNonRoot: true`
92+
* A new Profile called `restricted` which sets the Pod Security Context to use `RuntimeDefault` and `runAsNonRoot: true` - any name can be used, or you could update an existing Profile that you're already using
9393
* A function called `env` which uses the `restricted` Profile
9494

9595
```yaml
@@ -161,6 +161,46 @@ securityContext:
161161
runAsNonRoot: true
162162
```
163163

164+
To upgrade existing functions, upgrade OpenFaaS via Helm, then run:
165+
166+
```bash
167+
kubectl label namespace openfaas-fn pod-security.kubernetes.io/enforce=restricted
168+
```
169+
170+
Then edit or redeploy each affected function to add the `com.openfaas.profile: restricted` annotation.
171+
172+
```diff
173+
apiVersion: openfaas.com/v1
174+
kind: Function
175+
metadata:
176+
name: env
177+
namespace: restricted-fn
178+
spec:
179+
name: env
180+
image: ghcr.io/openfaas/alpine:latest
181+
environment:
182+
fprocess: "env"
183+
+ annotations:
184+
+ com.openfaas.profile: restricted
185+
```
186+
187+
If you are deploying functions via the REST API, update the deployment request as follows:
188+
189+
```diff
190+
{
191+
"name": "env",
192+
"image": "ghcr.io/openfaas/alpine:latest",
193+
"fprocess": "env",
194+
"annotations": {
195+
+ "com.openfaas.profile": "restricted"
196+
}
197+
}
198+
```
199+
200+
The name `restricted` can be changed to any name you like, but you should include the `podSecurityContext` values as shown above.
201+
202+
If you're already using Profiles for your functions, then you can update the `podSecurityContext` values in the existing Profile.
203+
164204
#### Use an Alternative RuntimeClass
165205

166206
!!! info "OpenFaaS for Enterprises"

0 commit comments

Comments
 (0)