2

Spinkube: Running WASM in Kubernetes

 6 months ago
source link: https://www.fermyon.com/blog/introducing-spinkube-fermyon-platform-for-k8s
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introducing SpinKube and Fermyon Platform for Kubernetes

Radu Matei & Mikkel Mørk Hegnhøj

Radu Matei & Mikkel Mørk Hegnhøj

Introducing SpinKube and Fermyon Platform for Kubernetes

Today, we are proud to introduce SpinKube and the Fermyon Platform for Kubernetes. Both projects enable Kubernetes to get first-class support for running Spin WebAssembly applications, giving you the opportunity to run your applications far more efficiently, and with higher density across any processing architecture, in your Kubernetes cluster.

SpinKube is an open source project that streamlines the experience of developing, deploying, and operating WebAssembly workloads on Kubernetes. SpinKube combines the Spin Operator, containerd Spin shim, and the runtime class manager (formerly KWasm) open source projects with contributions from Microsoft, SUSE, Liquid Reply, and Fermyon. It’s available today, and free to use.

Fermyon Platform for Kubernetes provides unseen density of applications on Kubernetes, in a robust, easy-to-use serverless platform that enables developers to quickly deploy WebAssembly (Wasm) applications to Kubernetes. It also enables enterprises to run more workloads on their Kubernetes clusters and easily scale up or down based on usage, thereby increasing performance and lowering costs. Fermyon Platform for Kubernetes runs on self-hosted infrastructure, whether cloud-hosted or on-premise, alleviating vendor lock-in. Fermyon Platform for Kubernetes is also available today, so please reach out for further information.

A look back at where we are with Spin and WebAssembly

Since the initial release of Spin, our mission has been to enable WebAssembly as a core technology in the next wave of cloud computing. With the release of Spin 2.2, we have implemented support for WASI 0.2, and today Spin gives you the best developer experience for producing wasi-http compatible Webassembly components.

Wasi-http components have up until now had many compatible hosts: Spin as a CLI, Fermyon Cloud, Wasmtime, and NGINX Unit (to mention some). With today’s releases, SpinKube and Fermyon Platform for Kubernetes are added to that list, and enable these portable workloads to run in Kubernetes.

SpinKube - a bit more details

As mentioned in the beginning, the SpinKube project is a collection of existing and new open source technologies. The goal of the project has been to gather, and align, the bits and pieces needed to make it really easy to run Spin WebAssembly applications on Kubernetes. Let’s see how easy it actually is:

Five shell commands to deploy a spin application

The Containerd Shim Spin

At the core of the project, is the Containerd Shim Spin. This shim implementation, uses runwasi, to enable containerd to run Spin WebAssembly applications in a Kubernetes cluster. The shim provides all the capabilities needed in a Kubernetes cluster, to pull application images from registries, start the applications and inject configuration, etc. This project has been contributed by the Microsoft Deislabs team to the SpinKube project.

The Runtime Class Manager

The Runtime Class Manager, is the successor to Kwasm, and a contribution by Liquid Reply and SUSE to SpinKube. The Runtime Class Manager enables you to easily annotate your nodes, to install and configure containerd with the Shim Spin, thus enabling Spin Webassembly applications.

The Spin Operator

Now this wouldn’t be a true Kubernetes project without an Operator :-) The Spin Operator enables you to define Spin WebAssembly applications as native resources in Kubernetes, and orchestrate the creation of deployments, pods, services, enabling integration with containers, and making Spin WebAssembly applications behave just like you would expect from any workload deployed to Kubernetes. The Spin Operator has been developed and contributed by Fermyon, to the SpinKube project.

The spin kube Plugin

And to make sure, you can get the best experience as a developer and operator, we’ve also enabled easy integration with the Spin CLI, by including the Kubernetes plugin for Spin, in the repository. This enables the easy steps of spin new —> spin build —> spin registry push —>spin kube scaffold —>kubctl -f apply. This is also a contribution of Fermyon.

Bringing all of these projects together under a non-restrictive open source license, enables everyone to start enjoying Spin WebAssembly workloads in Kubernetes.

Fermyon Platform for Kubernetes

Today, we’re also releasing Fermyon Platform for Kubernetes. With this release, we want to bring our technology behind Fermyon Cloud to your Kubernetes clusters. Fermyon Cloud is a highly scalable, multi-tenant WebAssembly platform that has proven to be able to achieve extreme density of applications by hosting more than 5,000 applications on a single node. 20 times the current pod limit in Kubernetes and often 50-100 times the number of pods running on a Kubernetes node. Starting today, we can show you how you can host 5,000 applications on a single Kubernetes node using the Fermyon Platform for Kubernetes.

Fermyon Platform for Kubernetes uses a highly specialized runtime in Kubernetes, to enable the high density of applications. This runtime will benefit scenarios where you have many applications with varying degrees of utilization over time. The instant availability of the applications (always scaled up, but not utilizing resources), and not having to get complicated scaling rules right, are clear immediate benefits you will get from the Fermyon Platform for Kubernetes. All of this while still being able to save 60% on your compute cost.

Fermyon Platform for Kubernetes uses the Spin Operator enabling to you choose the runtime of your applications inside your Kubernetes cluster (container-shim-spin or Fermyon Platform for Kubernetes), to get the best of both worlds.

For more information about The Fermyon Platform for Kubernetes, and to request a demonstration, please reach out here.

Why do we need Spin WebAssembly applications in Kubernetes?

WebAssembly brings us a lot of great benefits when developing services. The binary output is really small; it starts up instantaneously, is sandboxed, and is portable across processing architectures and operating systems. All of these benefits from WebAssembly, can be directly mapped to improvements in how we can run workloads in Kubernetes, and help solve some of today’s challenges faced when using containers:

  • The binary output is really small.

    • A key piece of any orchestration engine is to efficiently place a workload on a given node to run it. Smaller binaries makes the operation of downloading, extracting and eventually running a workload quick. A hello-world Spin WebAssembly application written in Rust is a 284KiB OCI image.
    OCI Manifest of a WebAssembly image
  • They start up almost immediately.

    • Once scheduled, a Spin WebAssembly component will start in less than a millisecond. This is particularly beneficial for Spin applications consisting of multiple components, and for any application scheduled with the Fermyon Platform for Kubernetes, as they are only loaded and run, when needed.
    SpinExecutor performance graph
  • They are sandboxed.

    • WebAssembly components are sandboxed and are by default denied access to resources on the system - e.g., the filesystem or networking, through its capability-based security design. This not only makes the workloads safe to for hosting untrusted code, but also enables you to efficiently host multiple apps in a single runtime instance, which is part of the efficiency the Fermyon Platform for Kubernetes runtime brings.
    Illustration of sandboxed WebAssembly modules
  • They are portable across processing architectures and operating systems.

    • You can swap out the underlying nodes processing architecture without having to produce separate pipelines and deploy artifacts. In many cases, switching to an ARM64-based server gives you an immediate cost saving.

      Illustration of one WebAssembly module running on multiple CPU arhictectures

Early Adopters and Collaborators

ZEISS, Microsoft and Fermyon have been working together on testing SpinKube with Azure Kubernetes Services, and existing workloads which ZEISS is running today. The setup includes the use of Azure Service Bus, Dapr, KEDA, Azure Kubernetes Services, Spin, and SpinKube to validate how well Spin WebAssembly applications perform in this environment, compared to the existing implementation using containers.

“Utilizing Spin WebAssembly with SpinKube on Microsoft’s Azure Kubernetes Service helps us to achieve faster scalability, and reach higher density without the need to dramatically change our operational posture. With that we’ve been able to take a Kubernetes batch process of tens of thousands of orders and cut the compute cost by 60% without trading off performance,” said Kai Walter, Distinguished Architect, ZEISS Group. “We are excited to see WebAssembly become a first-class workload in Kubernetes. SpinKube and Fermyon Platform for Kubernetes will reshape how we all do high-performance computing in Kubernetes.”

Some members of the cloud-native community have also had a chance to try out SpinKube prior to the launch, providing the following feedback on the experience:

“The SpinKube project uses all the conventional Kubernetes tools to easily get it installed and set up. It took me 5 minutes before I could start deploying Spin WebAssembly applications to my cluster,” said Kasper Juul Hermansen, Platform/Data Engineer, Lunar.

To learn more about:

  • the SpinKube project, how to try it out, and how to get involved in the project, check out the spinkube.dev website.
  • the Fermyon Platform for Kubernetes, and scheduling a demonstration and technical walk-through, check out here.
  • developing Spin applications, check out the quickstart, and examples of applications on the Spin Up Hub.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK