Skip to content

Commit 978b381

Browse files
committed
blog: add runtimeclassnames post
adds a blog post for configuring Knative Serving to use RuntimeClasses
1 parent 421c8e4 commit 978b381

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

blog/config/nav.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ nav:
4949
- releases/announcing-knative-v0-3-release.md
5050
- releases/announcing-knative-v0-2-release.md
5151
- Articles:
52+
- articles/configurable-runtimeclassnames.md
5253
- articles/consuming_sqs_data_with_integrationsource.md
5354
- articles/knative-backstage-security.md
5455
- articles/Knative-Serving-WebSockets.md
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Configurable RuntimeClassNames
2+
3+
**Author: Caleb Woodbine**
4+
5+
Starting in Knative Serving v1.15, administrators are now able to configure the default the RuntimeClassName field for deployments as default and via a Knative Service label selector.
6+
7+
## Runtime Classes
8+
9+
**What is a Runtime Class?**
10+
11+
Runtime Classes configure the runtime of a container with settings and handlers, such as `runc`, `crun`, `runsc`, `nvidia`/`nvidia-cdi` or `kata`. `runc` being the defacto which provides kernel-level isolation which is often unsuitable for running untrusted workloads.
12+
13+
See documentation at the Kubernetes docs [here](https://kubernetes.io/docs/concepts/containers/runtime-class/).
14+
15+
## Existing configuration options
16+
17+
There are several feature flags in Knative Serving, one of which is enabling the field `.spec.template.spec.runtimeClassName` in Knative Service.
18+
19+
This may be useful for self-service and is a helpful feature flag.
20+
21+
See the documentation [here](https://knative.dev/docs/serving/configuration/feature-flags/#kubernetes-runtime-class).
22+
23+
## Configuring Knative Serving
24+
25+
Knative Serving is able to be configured with either the ConfigMaps if deployed with plain manifests or the KnativeServing resource if deployed with the operator. The following examples will be using just the plain manifests.
26+
27+
See this example where Knative Serving will configure deployments managed by Knative through Services to use Kata by default or gVisor when the Knative Service has a label matching `my-label=selector`:
28+
29+
```yaml
30+
apiVersion: v1
31+
kind: ConfigMap
32+
metadata:
33+
name: config-deployment
34+
namespace: knative-serving
35+
data:
36+
runtime-class-name: |
37+
kata: {}
38+
gvisor:
39+
selector:
40+
my-label: selector
41+
```
42+
43+
The keys, like `kata` and `gvisor` must match existing Kubernetes RuntimeClasses.
44+
45+
**Please note**: _often the config above may not necessarily make sense for real world use but does display how it can be configured._
46+
47+
For Knative docs, [see here](https://knative.dev/docs/serving/configuration/deployment/#configuring-selectable-runtimeclassname).
48+
49+
## Why is this important?
50+
51+
RuntimeClasses enable several things, including:
52+
53+
- security
54+
- isolation such as through Kata or gVisor
55+
- functionality
56+
- such as enabling GPU (e.g NVIDIA) or WASM (e.g Spinkube) support
57+
58+
For example, a cluster administrator or cloud provider may wish to configure Knative Serving to specificly not use `runc` to run untrusted workloads that would be deployed by users on their platform.
59+
60+
By default, Kubernetes does not have a default RuntimeClass feature/annotation (like StorageClass does) and it must be altered at a container runtime level as it is also inherited therein. This feature along with the ease of Knative Service config, it elevates the abilities of Knative Serving above standard Kubernetes.
61+
62+
## Closing
63+
64+
Runtime Classes are an important piece in container platform infrastructure.
65+
Whether you're setting up a platform for production or just playing around, Runtime Classes can enhance or lockdown your workloads.
66+
67+
Now with the Knative Serving deployment configuration settings for RuntimeClass, there's even more ability to configure Knative Services in a locked down and specific manner.

0 commit comments

Comments
 (0)