Skip to content

Commit

Permalink
feat: update gvisor extension after testing
Browse files Browse the repository at this point in the history
This extension was tested with Talos, there's one issue with cgroups
which required disabling cgroup support in `runsc`.

Fixed up manifest and added documentation on using the extension.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Jan 25, 2022
1 parent c927b54 commit 33082a2
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
53 changes: 53 additions & 0 deletions gvisor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# gVisor extension

## Usage

Enable the extension in the machine configuration before installing Talos:

```yaml
machine:
install:
extensions:
- image: ghcr.io/talos-systems/gvisor:<VERSION>
```
gVisor requires unprivileged user namespace creation, so Talos default setting
should be overridden:
```yaml
machine:
sysctls:
user.max_user_namespaces: "11255"
```
> Warning! This disables [KSPP best practices](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#sysctls) setting.
## Testing
Apply the following manifest to run nginx pod via gVisor:
```yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: gvisor
handler: runsc
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-gvisor
spec:
runtimeClassName: gvisor
containers:
- name: nginx
image: nginx
```
The pod should be up and running:
```bash
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-gvisor 1/1 Running 0 40s
```
4 changes: 4 additions & 0 deletions gvisor/gvisor.part
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runsc]
runtime_type = "io.containerd.runsc.v1"

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runsc.options]
TypeUrl = "io.containerd.runsc.v1.options"
ConfigPath = "/etc/cri/conf.d/runsc.toml"
2 changes: 1 addition & 1 deletion gvisor/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ metadata:
This system extension provides gVisor using containerd's runtime handler.
compatibility:
talos:
version: ">= v1.0.0"
version: "> v0.15.0-alpha.1"
2 changes: 2 additions & 0 deletions gvisor/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ finalize:
to: /
- from: /pkg/gvisor.part
to: /rootfs/etc/cri/conf.d/gvisor.part
- from: /pkg/runsc.toml
to: /rootfs/etc/cri/conf.d/runsc.toml
3 changes: 3 additions & 0 deletions gvisor/runsc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[runsc_config]
# See https://github.com/talos-systems/extensions/issues/4
ignore-cgroups = "true"

0 comments on commit 33082a2

Please sign in to comment.