Think container orchestration different – WASM is coming

A presentation at DevOpsCon London in April 2022 in London, UK by Max Körbächer

Slide 1

Slide 1

Think container orchestration different – WASM is coming Christoph Voigt & Max Körbächer | Co-Founder of Liquid Reply

Slide 2

Slide 2

Who are we? Max Körbächer Christoph Voigt Co-Founder and Kubernetes Platform Engineer at Liquid Reply Co-Founder and developer of Liquid Reply Former Enterprise Architect, focusing on Kubernetes and Cloud Native Infrastructure. Software Engineering background, having a focus on Cloud Native Infrastructureand Application-Architectures Contributing to the Kubernetes release team and related K8s technologies Contributing to the Kubernetes release team and related K8s technologies Servant for a 🐈 Father of two 󰔠

Slide 3

Slide 3

Liquid Reply is the Kubernetes and Cloud-Native consultancy of the Reply Network. We help our clients entangling difficulties of modern IT-Infrastructure, developing, architecting and teaching cloud-native technologies.

Slide 4

Slide 4

Todays Journey WebAssembly (WASM) is at an inflection point: Over the next few years, we expect to see increased adoption of WebAssembly across the tech sphere, from containerization to plugin systems to serverless computing platforms What is WASM and how is it even relevant? 🧐 What is the status quo of the WASM ecosystem? 󰝋 Conclusion and look into the glass bowl 🔮

Slide 5

Slide 5

WebAssembly Intro

Slide 6

Slide 6

src: https://twitter.com/solomonstre/status/1111004913222324225

Slide 7

Slide 7

What is WebAssembly? Think of it as an intermediate layer between various programming languages and many different execution environments. You can take code written in over 30 different languages and compile it into a *.wasm file, and then can execute that file on any WASM Runtime. The name “WebAssembly” is misleading. Initially designed to make code run fast on the web, today it can run anywhere. WebAssembly oversimplified: ⚡ Consistently fast 🔬 Small WebAssembly is: ● ● ● ● stack-based VM executing binary file formats CPU-agnostic -> taking any architecture OS-agnostic Entirely depends on the host runtime (we will talk later about it) 🌍 Universal ♻ Reusable

Slide 8

Slide 8

Benefits of WebAssembly Fast Slightly adjusted; Source: https://b-nova.com/home/content/containerless-mit-webassembly-runtimes*

Slide 9

Slide 9

Where can WebAssembly be applied? *outside the Browser 🪢 🧩 Language Plugin Systems Interoperability 🖼 Embedded Sandboxing 🔗 📦 Blockchains Containerisation 🧮 Serverless Platforms Write that library once in a language of your choice; use in any language. Never trust third parties! Prevent yourself against bugs of third party libraries. Write Smart Contracts in a language of your choice. Universal Runtime, capability based security model. Minimal Startup time, maximal isolation. Figma Lichess.org Google Earth Adobe Photoshop Envoy / Istio Kubewarden MS Flight Simulator Minecraft RedPanda Firefox HTTP Servers CosmWasm eWASM Krustlet Hippo wasmCloud Lunatic WasmEdge Cloudflare Workers AWS Lambda Atmo (Suborbital) Fastly Compute@Edge

Slide 10

Slide 10

A new paradigm ahead? Image Source (adjusted): Liam Randall (@Hectaman) - https://twitter.com/Hectaman/status/1389585069073895434

Slide 11

Slide 11

A new paradigm ahead? Image Source (adjusted): Liam Randall (@Hectaman) - https://twitter.com/Hectaman/status/1389585069073895434

Slide 12

Slide 12

Some WASM implementations (a subjective choice)

Slide 13

Slide 13

Krustlet What problem does it aim to solve? - Kubernetes Cluster technology could be a good fit to orchestrate WASM modules similar to containers The advantages of WASM modules in a cluster compared to a Container? - security sandboxed by default - reduce upstart time - decreases footprint - hardware (host) independent (hi arm/x86 containers!) Kubernetes Kubernetes API Server Node Kubelet CRI Runtime Docker CRI-O container-d … OCI Runtime

instead of containers, we want to start wasm runtimes crun runc gVisor … Linux Container Images A Regular Kubernetes Stack

Slide 14

Slide 14

Krustlet Solution Approach - Krustlet acts as a Kubelet by listening on the event stream for new pods that the scheduler assigns to it based on specific Kubernetes tolerations. Kubernetes Kubernetes API Server Node

The default implementation of Krustlet listens for the architecture wasm32-wasi and schedules those workloads to run in a wasmtime-based runtime instead of a container runtime. Krustlet Wasmtime wasi WASM Module A Krustlet Kubernetes Stack

Slide 15

Slide 15

Krustlet Solution Approach - Krustlet acts as a Kubelet by listening on the event stream for new pods that the scheduler assigns to it based on specific Kubernetes tolerations.

The default implementation of Krustlet listens for the architecture wasm32-wasi and schedules those workloads to run in a wasmtime-based runtime instead of a container runtime.

Slide 16

Slide 16

Krustlet Solution Approach Advantages ➕ add “wasm nodes” to your cluster without changing the entire cluster setup ➕ use the same Pod-Spec as for your normal Pods ➕ CSI support ➕ Plugin-Support Try it in Kind: https://github.com/Liquid-Reply/kind/tree/kind-krustlet Considerations ➖ either Kubelet OR Krustlet ➖ as there is no container runtime, you need toleration configs to avoid scheduling of “normal” cluster-wide daemonset* (e.g. CNI) ➖ your modules are only allowed to do what the runtime permits → no Network for your modules! ➖ wasi + wasmtime under heavy development → so is Krustlet

  • There is a Container Runtime Interface provider implementation for Krustlet. This runtime allows you to run the containers you know and love within Krustlet.

Slide 17

Slide 17

WasmEdge Integrating with existing tooling, and more … ● ● Aims to solve similar problems as Krustlet, but in a more flexible and leaner way Kubernetes Especially targets the integration in various Kubernetes distributions, CRI runtimes as well as OCI runtimes - therefore a good match to run WASM side by side with classic containers Node Kubernetes API Server Kubelet CRI Runtime Docker CRI-O container-d ● Runs also stand alone for modern web apps, to host serverless functions and being “embedded” in any kind of edge device. … OCI Runtime crun runc Linux Container Images gVisor … WebAssembly app images The Container Eco-System based on: https://wasmedge.org/book/en/kubernetes.html

Slide 18

Slide 18

WasmEdge Solution Approach WasmEdge is different on the image level. Rather than having a container image with a OS, the WASM image is build from scratch. In addition, the container requires an “wasm.image” annotation, to let crun and containerd know that it use WasmEdge. This approach allows to use WASM within the Kubernetes context, and utilize the existing ecosystem. *http server wasm image within a docker file *a wasm container requires the wasm image annotation

Slide 19

Slide 19

WasmEdge Solution Approach Advantages Considerations ➕ WasmEdge can run alongside your standard ➖ Additional tools for image annotation are required (at the moment) containers ➖ For some use cases you need another SDK ➕ Build and deployment spec are nearly the ➖ It can lead to confusion that you can use same as for a normal pod WasmEdge in very different scenarios and each of ➕ Supports different CRI, OCI and K8s distros them has to be developed differently ➕ Can use existing K8s ecosystem ➕ Runs by itself on edge, serverless or browser From all tools we show today, WasmEdge would be the best choice to extend your currently orchestration without deep cutting changes

Slide 20

Slide 20

WasmCloud What problem does it aim to solve? - wasmCloud is a distributed platform for writing portable business logic that can run anywhere from the edge to the cloud. Secure by default, wasmCloud aims to strip wasteful boilerplate from the developer experience.

Business-Applications contain a lot of boilerplate: - Webserver - integrated dependencies (Database, Caches) - tight coupling to non-functional requirements - Security (certificates etc.) - …

Only a fraction is actual business logic

Slide 21

Slide 21

WasmCloud The Solution wasmCloud Host Runtime 󰠼 󰠼 Actor Actor 󰠼 Actor wasmCloud Host Runtime 󰠼 󰠼 Actor Actor Actor 🤝 󰠼 Capability Provider … 🤝 Capability Provider Three core concepts: - 🕸 Lattice Self-Forming = Self-Healing Flat Topology Actor Capability Provider Lattice

Slide 22

Slide 22

WasmCloud Reach and Resilience backed by the Lattice 🏢 Data Center Cloud B Lattice ☁ ☁ Cloud A 📱

Slide 23

Slide 23

WasmCloud Reach and Resilience backed by the Lattice 🏢 Data Center 📱 Cloud B Lattice ☁ ☁ Cloud A ⚡

Slide 24

Slide 24

WasmCloud Reach and Resilience backed by the Lattice 🏢 Data Center 📱 Cloud B Lattice ☁ ☁ Cloud A ⚡

Slide 25

Slide 25

WasmCloud Solution Approach Advantages ➕ ➕ ➕ ➕ ➕ ➕ high focus on writing business logic potentially high reusability of WASM modules high isolation high amount of security high resiliency HostRuntimes can run “anywhere” (Bare metal, VM, Container, Kubernetes, Webbrowser…) Considerations ➖ applications need to be written with WasmCloud in mind ➖ currently Rust is the only supported language; though other languages are planned ➖ still very young project - expect rough edges ➖ tooling for debugging and monitoring rudimentary

Slide 26

Slide 26

Summary

Slide 27

Slide 27

WASM Ecosystem ● The WASM ecosystem is under heavy development ● Many tools are new or getting continuously reshaped ● This is reflected in the CNCF WASM landscape

Slide 28

Slide 28

A missing extension? Docker-like container WebAssembly OK Great Resource footprint Poor Great Isolation OK Great Safety OK Great Portability OK Great Security OK Great Language and framework choice Great OK (yet) Ease of use Great OK (yet) Manageability Great Great Performance

Slide 29

Slide 29

Containers for lifting, WASM for re-creating Go with the Container flow Build with WASM for the future Containers will stay and drastically increase in usage over the next years. But for future developments WASM might be in many cases a better choice. We believe that WASM & Container will go along side by side

Slide 30

Slide 30

Conclusion 1 3 5 WebAssembly’s potential is beyond the browser WASM will not substitute containers & K8s, but extend them The developer experience of/for WASM will be the game changer 2 WASM enables use cases that are not possible with container & K8s 4 WASM lacks harmonization and makes it difficult for programming languages to adapt

Slide 31

Slide 31

WASM will be ubiquitous

Slide 32

Slide 32

Sources - https://www.infoworld.com/article/3651503/the-rise-of-webassembly.html https://harshal.sheth.io/2022/01/31/webassembly.html *** https://nickymeuleman.netlify.app/blog/webassembly *** https://docs.krustlet.dev/topics/architecture/ https://docs.krustlet.dev/topics/providers/ https://github.com/Liquid-Reply/kind/tree/kind-krustlet (Krustlet baked into Kind:) https://bytecodealliance.org/articles/announcing-the-bytecode-alliance *** https://thenewstack.io/what-is-webassembly/ https://www.youtube.com/watch?v=vqBtoPJoQOE https://istio.io/latest/docs/concepts/wasm/ https://www.kubewarden.io/ https://docs.flightsimulator.com/html/Programming_Tools/WASM/WebAssembly.htm https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/ https://almanac.httparchive.org/en/2021/webassembly https://harshal.sheth.io/2022/01/31/webassembly.html https://github.com/deislabs/hippo https://github.com/lunatic-solutions/lunatic https://github.com/suborbital/atmo https://blog.cloudflare.com/webassembly-on-cloudflare-workers/ https://www.fastly.com/blog/how-compute-edge-is-tackling-the-most-frustrating-aspects-of-serverless https://cosmwasm.com/ https://github.com/ewasm/design https://wasmcloud.dev/reference/host-runtime/

Slide 33

Slide 33

Thank you!