Skip to content

Commit 9353605

Browse files
committed
Merge pull request #11082 from BobyMCbobs:update-gvisor-knative-user-guide
PiperOrigin-RevId: 735931626
2 parents c16484e + c7a4fdd commit 9353605

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

g3doc/user_guide/tutorials/knative.md

+33-20
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,60 @@ workloads. This could be a
1212
cluster on Google Cloud Platform or one you have set up yourself using
1313
[containerd Quick Start](https://gvisor.dev/docs/user_guide/containerd/quick_start/).
1414

15-
This guide will also assume you have Knative installed using
16-
[Istio](https://istio.io/) as the network layer. You can follow the
15+
Follow the
1716
[Knative installation guide](https://knative.dev/docs/install/install-serving-with-yaml/)
1817
to install Knative.
1918

20-
## Enable the RuntimeClass feature flag
19+
## Enable the RuntimeClassName deployment config
2120

2221
Knative allows the use of various parameters on Pods via
23-
[feature flags](https://knative.dev/docs/serving/feature-flags/). We will enable
24-
the
25-
[runtimeClassName](https://knative.dev/docs/serving/feature-flags/#kubernetes-runtime-class)
26-
feature flag to enable the use of the Kubernetes
27-
[Runtime Class](https://kubernetes.io/docs/concepts/containers/runtime-class/).
22+
[deployment configs](https://knative.dev/docs/serving/configuration/deployment)
23+
amongst other things. We will set the
24+
[runtime-class-name](https://knative.dev/docs/serving/configuration/deployment/#configuring-selectable-runtimeclassname)
25+
property to configure the Kubernetes deployments created by Knative.
2826

29-
Edit the feature flags ConfigMap.
27+
Edit the deployment ConfigMap.
3028

3129
```bash
32-
kubectl edit configmap config-features -n knative-serving
30+
kubectl edit configmap config-deployment -n knative-serving
3331
```
3432

35-
Add the `kubernetes.podspec-runtimeclassname: enabled` to the `data` field. Once
36-
you are finished the ConfigMap will look something like this (minus all the
37-
system fields).
33+
Setting the `runtime-class-name` configures the Pod field by label selectors.
34+
35+
Enforce all Pods run through Knative to use gVisor as the Runtime Class:
36+
37+
```yaml
38+
apiVersion: v1
39+
kind: ConfigMap
40+
metadata:
41+
name: config-deployment
42+
namespace: knative-serving
43+
data:
44+
runtime-class-name: |
45+
gvisor: {}
46+
```
47+
48+
Allow exception for Pods to run without gVisor as the Runtime Class when a label
49+
is set:
3850
3951
```yaml
4052
apiVersion: v1
4153
kind: ConfigMap
4254
metadata:
43-
name: config-features
55+
name: config-deployment
4456
namespace: knative-serving
45-
labels:
46-
serving.knative.dev/release: v0.22.0
4757
data:
48-
kubernetes.podspec-runtimeclassname: enabled
58+
runtime-class-name: |
59+
"":
60+
selector:
61+
no-isolation-here: "true"
62+
gvisor: {}
4963
```
5064
5165
## Deploy the Service
5266
53-
After you have set the Runtime Class feature flag you can now create Knative
54-
services that specify a `runtimeClassName` in the spec.
67+
After you have set the Runtime Class deployment config you can now create
68+
Knative Service.
5569
5670
```bash
5771
cat <<EOF | kubectl apply -f -
@@ -62,7 +76,6 @@ metadata:
6276
spec:
6377
template:
6478
spec:
65-
runtimeClassName: gvisor
6679
containers:
6780
- image: gcr.io/knative-samples/helloworld-go
6881
env:

0 commit comments

Comments
 (0)