January 19, 2024

Introducing Fermyon Spin with Openshift

Chris Matteson Chris Matteson

advent of spin coding challenge

Introducing Fermyon Spin with Openshift

At Openshift Commons back in October 2023, we announced support for Spin on Red Hat Openshift. You can watch the video of that talk here and see the slides here. This blog was slated to go out in the months there-after but was lost into the holiday madness. So without further delay, we want to publicly announce support for Openshift for WebAssembly with Fermyon Spin.

What is WebAssembly and Fermyon Spin?

The short answer for this blog is that WebAssembly is a binary format originally written for web browsers that allows code to be written in any supported language, compiled into bytecode, and then executed on any operating system and CPU architecture. It’s fast, it’s portable, and it’s secure by default.

Fermyon Spin is an implementation of the WebAssembly Systems Interface (WASI) standards on top of the Wasmtime runtime that makes it easy to use WebAssembly for backend serverless use cases.

You can learn more about WebAssembly and Spin in these except primers here and here.

How did we end up here?

Spin is an excellent tool for building serverless functions powered by WebAssembly, but they still need to be run somewhere. With Spin, you can run your functions locally or use a service manager to run them in a server, but that largely misses the value of a hyperscalable serverless system.

At Fermyon we built Fermyon Cloud to allow you to deploy your applications to the internet. It’s incredibly efficient with densities in the many thousands of applications per node. In order to accomplish this, we used HashiCorp’s Nomad. It’s lightweight, easy to use, and very scalable. What it isn’t, however, is the most popular scheduler.

Kubernetes has largely taken the world by storm. We’ve gone through quite a few iterations of using Spin with Kubernetes:

  • First came along Virtual Kubelet using Krustlet. Technically it worked but we viewed it as a failure to accomplish anything meaningful.
  • Second was a Containerd shim written by what was the Deis Labs team at Microsoft to deploy Wasm workloads to AKS. This has been extended to run in any Kubernetes cluster and now works on all known cloud providers with a Kubernetes service. It can be installed using the Fermyon installer helm chart, or Kwasm. Soon it will also be available on cloud marketplaces.
  • Third was the Spin Kubernetes Plugin which made it easier to package spin apps as containers as the shim initially required wrapping containers due to limitations in Containerd.
  • Finally fourth came Native Support for OCI Artifacts. Fermyon worked with Liquid Reply (creators of Kwasm) to build native support in Containerd for OCI artifacts, greatly simplifying the process and improving the user experience.

However, the shim still required runc runtime to work. This excluded OpenShift since Red Hat had written their own highly scalable runtime in crun. In order to correct this, part of the work Fermyon engaged Liquid Reply for included providing crun support for Spin. Now OpenShift users can have the same easy experience deploying WebAssembly applications with Spin as users of other Kubernetes architectures. To demonstrate this process, we’ve included a demo below.

Installation

asciicast

Deploy App

asciicast

Conclusion

We aren’t done yet improving Fermyon Spin experience on Kubernetes. Expect more to come! If you have questions or particular features you’d love to see, hit us up on our Discord community.


🔥 Recommended Posts


Quickstart Your Serveless Apps with Spin

Get Started