Slide 1

Slide 1 text

Possibility of OCI Container Runtime with Rust Toru Komatsu (@utam0k) Senior Enginner at Gitpod 1

Slide 2

Slide 2 text

Toru Komatsu, Senior Engineer at Gitpod utam0k utam0k A member of containers organization I develop youki as a hobby 2

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

What I'd like to tell 01 4

Slide 5

Slide 5 text

Today you will learn Based on our experience of developing youki, the OCI Runtime in Rust, I'll introduce the compatibility and attractiveness of Rust and OCI Runtime. And about the current status and future of youki. 5

Slide 6

Slide 6 text

Agenda 01 What I'd like to tell 02 What is OCI Container Runtime? 03 Why Rust? 04 Where we are now 05 Problems and Future 6

Slide 7

Slide 7 text

What is OCI Container Runtime? 02 7

Slide 8

Slide 8 text

Kubelet(K8s) Container creation flow from kubelet Linux etc… High-Level Runtime CRI Low-Level Runtime runc runsc kata OCI Container Runtime 8

Slide 9

Slide 9 text

How do we create containers? pivot_root(2) Change a destination that the root directory of a process points to namespace(7) Ability to isolate resources that a process can manipulate cgroup Allows configuration of resources available to processes(containers) 9

Slide 10

Slide 10 text

Youki OCI Container Runtime in Rust Developed since January 2021 Vendor Neutral Under the Containers organization, which manages podman, etc. https://github.com/containers/youki 4.0K ⭐ on GitHub Provide a Rust library for OCI from a part of youki youki means a container in Japanese 10

Slide 11

Slide 11 text

Why Rust? 03 11

Slide 12

Slide 12 text

Benefits of using Rust Close to kernel WASM Lighter-weight 12

Slide 13

Slide 13 text

Benefits of using Rust WASM Lighter-weight Close to kernel Avoiding namespace restrictions 13

Slide 14

Slide 14 text

setns(2) - reassociate thread with a namespace A multithreaded process may not change user namespace with setns(). 14

Slide 15

Slide 15 text

netns(2) with Go HighLevelCR HighLevelCR runc create Only Go runc create Only Go runc init C&Go runc init C&Go Create a container Prepare to create a container such as cgroup /proc/self/exec init with args as ENVs Actually create a container 15

Slide 16

Slide 16 text

netns(2) with Go HighLevelCR HighLevelCR runc create Only Go runc create Only Go runc init C&Go runc init C&Go Create a container Prepare to create a container such as cgroup /proc/self/exec init with args as ENVs Actually create a container 16

Slide 17

Slide 17 text

netns(2) with Go HighLevelCR HighLevelCR runc create Only Go runc create Only Go runc init C&Go runc init C&Go Create a container Prepare to create a container such as cgroup /proc/self/exec init with args as ENVs Actually create a container 17

Slide 18

Slide 18 text

netns(2) with Go HighLevelCR HighLevelCR runc create Only Go runc create Only Go runc init C&Go runc init C&Go Create a container Prepare to create a container such as cgroup /proc/self/exec init with args as ENVs Actually create a container 18

Slide 19

Slide 19 text

• • • • • There is no limit around the namespace(7) Rust can be implemented alone with a minimum number of clones Fewer potential security holes because no extra operations are required CVE-2019-5736 does not happen with Rust implementation Rust has been adopted as a second language for Linux Ⓒ The Rust foundation 19

Slide 20

Slide 20 text

• • buddy-buddy How to use → https://containers.github.io/youki/user /webassembly.html Ⓒ The Rust foundation 20

Slide 21

Slide 21 text

Ⓒ The Rust foundation 21

Slide 22

Slide 22 text

Benefits of using Rust Close to kernel WASM Lighter-weight 22

Slide 23

Slide 23 text

Runtime Language Time (mean ± σ) Range (min … max) crun C 153.5 ms ± 21.6 ms 80.9 ms … 196.6 ms youki Rust 198.4 ms ± 52.1 ms 97.2 ms … 296.1 ms runc Go 352.3 ms ± 53.3 ms 248.3 ms … 772.2 ms Time from container startup to deletion 23

Slide 24

Slide 24 text

What kind of future can you imagine with lightweight container runtime? IoT? running it in a car? lighter-weight 24

Slide 25

Slide 25 text

Benefits of using Rust Close to kernel Avoiding namespace restrictions WASM New Possibilities Lighter-weight Less memory used, better performance 25

Slide 26

Slide 26 text

Why Go? Why Rust? To begin with, runc was initially part of Docker and spun out from it. Much used in this community and has a lot of history. Go is mature in this area. Therefore, libraries are abundant But there is a problem that cannot be solved around the namespace. In other words, it cannot be implemented by Go alone, strictly. Why Go? Simple, safe, and incidentally light However, there is not much history and libraries. Why Rust? 26

Slide 27

Slide 27 text

Where we are now 04 27

Slide 28

Slide 28 text

Fighting with the real • ✅ Test for OCI Runtime prepared by OCI ✅ Containerd integration test Achieved primarily through @YJDoc2 28

Slide 29

Slide 29 text

For Kubernetes ✅ kubeadm supported youki 29

Slide 30

Slide 30 text

Advanced Features ✅ WASM ✅ cgroup v2 ✅ Rootless 30

Slide 31

Slide 31 text

Problems and Future 05 31

Slide 32

Slide 32 text

Problems Old kernels Experience 32

Slide 33

Slide 33 text

Problems Old kernels Experience 33

Slide 34

Slide 34 text

We are creating the future Ideally, we have to support old Linux kernels, but it is challenging, and other container runtimes have already been supported. We would like to imagine beautiful futures with the latest kernel technology instead of dropping them off. 34

Slide 35

Slide 35 text

Problems Old kernels Experience 35

Slide 36

Slide 36 text

Standing on the shoulders of giants Let's use the history of OCI Container Runtime pioneers! OCI Runtime is just a binary. Let's cheat on the name and use the giant test. 36

Slide 37

Slide 37 text

Roadmap/ upcoming tasks/ events 2023・2024 Pass the integration test of runc and others containers/youki#1305 OpenTelemetry tracing support to extend observability containers/youki#1348 Contribute to WASM world containers/youki#1320 Consider ideas using the latest technologies such as eBPF and io_uring 37

Slide 38

Slide 38 text

38

Slide 39

Slide 39 text

runwasi • • • • • • • • Low-level container runtime designed for WASM in Rust Still not meeting OCI Runtime Spec Used by Docker WAM Azure Kubernetes Service for WASM https://learn.microsoft.com/en-us/azure/aks/use-wasi- node-pools repo: containers/runwasi First committed by Deis Labs, a Microsoft group company 39

Slide 40

Slide 40 text

youki    runwasi 40

Slide 41

Slide 41 text

Thanks to all the heroes who contributed to youki 41

Slide 42

Slide 42 text

Thanks! Any question? Toru Komatsu utam0k utam0k github.com/containers/youki 42