August 08, 2023

From Bare Metal to Kubernetes: 6 Ways to Spin

Matt Butcher Matt Butcher

spin kubernetes nomad fermyon cloud

From Bare Metal to Kubernetes: 6 Ways to Spin

Spin is our open source developer framework for building serverless apps with WebAssembly. Serverless v1 platforms like AWS Lambda often came with a vendor lock-in story: The functions only run on one cloud provider’s platform. One of our design goals while building a next wave of serverless was to get rid of vendor lock-in. Did you know that you can run Spin in many places? In this article, we cover six examples.

1. Locally

The easiest place to run a Spin application is in Spin itself. As part of the development process, Spin can run its own apps. You can see this in action by installing Spin and then running this command:

$ spin up -f

Serving <>
Available Routes:
  dioxus-test: <> (wildcard)
  images: <> (wildcard)

The above starts a Spin server and then fetches a simple program from the GitHub Container Registry (GHCR). Spin packages applications using the OCI standard (the format Docker uses). So you can store Spin apps in places like DockerHub or GHCR.

Of course, it’s also very easy to create a brand new Spin app and have it up and running in minutes. Here’s a short example for folks who already have the Rust toolchain installed. Similar examples apply for Go, Python, Swift, C, Zig, and other languages.

$ spin new http-rust example # And answer the questions
$ cd example
$ spin build --up # Compile and start.

The spin tool can run any Spin application as long as it can locate the spin.toml file for the application.

2. Fermyon Cloud

While using spin up is great for local development, chances are you want to put your application somewhere where other people can see it.

And the easiest place to host a Spin application is on Fermyon Cloud. Running spin login will log you in, or create an account if you don’t have one. Don’t worry, it’s super simple and takes less than a minute.

Once you are logged in, you can deploy the app. It’s as easy as running spin deploy. In the last section we created an app called example. Here’s how to deploy that to Fermyon Cloud:

$ spin deploy
Uploading example version 0.1.0+r8f5d4e5...
Waiting for application to become ready....... ready
Available Routes:
  example: <> (wildcard)

Note that spin has given us a URL that is specific to the app we just deployed. Your URL will be different from the one above.

Fermyon Cloud provides many useful features, like a SQLite database, a managed key/value storage system, and custom domains.

3. Kubernetes

Kubernetes is the platform of choice for running Docker-style containers in production. But it can also run Spin applications if you configure this feature.

If you are on a Kubernetes distribution that supports Spin, like Azure’s AKS, then you may only need to consult the distribution’s documentation to see how to enable Spin.

Otherwise, you may want to use a project like Kwasm to install a Spin runtime onto your Kubernetes cluster.

4. On the Cloud Platform of Your Choice using HashiCorp Nomad

In 2022, Fermyon released a reference implementation for running Spin applications on the cloud of your choice. Fermyon Platform uses HashiCorp’s Terraform, Nomad, Consul, and Vault (along with the Traefik proxy) to run Spin in the cloud.

While Fermyon Platform is not as feature-rich as Fermyon Cloud, you can install it on a variety of different platforms, and configure it as you wish. Fermyon Platform has been tested on a variety of cloud providers, including:

You can check out all of the terraform installers in our Fermyon Installer repo on GitHub.

While installing and running Fermyon Platform takes more work than Fermyon Cloud, it’s a good route if you want to start building your own hosted Spin environment.

5. Docker Desktop

Docker Desktop now supports running Spin applications as of Docker Desktop 4.21.

Working with Docker Desktop requires you to do a few things:

  • You’ll need to turn on WebAssembly support in Docker Desktop
  • From there, you can build a Spin app as normal
  • Once you’ve done that, create a new scratch container image with the Wasm files inside of it
  • And then you can deploy the app using docker run

We wrote a complete blog post to explain the ins and outs of working with Docker.

6. Building your own

If none of these scratch your technical itch, you can simply install Fermyon Spin onto a system of your choice and use it as a server process. You can also use Spin as a library in your own code. Fermyon’s own Ivan Towlson wrote a post about building a custom Spin host runtime to show how flexible the Spin libraries are.

Whether you are building your own host runtime and orchestrator or just embedding the Spin binary somewhere, here are a few ideas to get you started:

  • You may want to build and run on a Raspberry Pi
  • Or toy around with creating a minimal VM or container image runs Spin apps
  • Or perhaps try out Spin on a less-frequently-used OS or architecture (like RISC-V)

Have you done one of these? We’d love to have you share with the community. And the easiest way to do this is to open a pull request to include your guide on the Fermyon Spin Up Hub.


When it comes to running your application, Spin is a flexible framework. Whether it’s locally, in Fermyon Cloud, Kubernetes, Nomad, Docker Desktop, or your own custom environment, Spin can execute the serverless applications you create.

Ready for some inspiration? Head over to the Fermyon Spin Up Hub!




🔥 Recommended Posts

Quickstart Your Serveless Apps with Spin

Get Started