Serverless Apps in Kubernetes
Earlier we covered the various serverless solutions in Kubernetes. Here, we talk more specifically about how these applications look when running inside of Kubernetes.
Spin WebAssembly serverless apps can run inside of Kubernetes, and there are several ways to try this out.
- The SpinKube project provides all the trappings you need for running Serverless Apps inside of your Kubernetes cluster.
- Locally, it is very easy to get started with Kubernetes in RancherDesktop with Spin
- Azure’s Kubernetes Service (AKS) can run Spin apps. There’s a great explanatory tutorial that shows how to use .NET-based Spin apps in AKS.
- Almost every Kubernetes flavor can run Spin applications with SpinKube
Once you have SpinKube installed in any of those environments, you can build and deploy your applications in just four steps:
$ spin new # Create a new app
$ spin build # Compile it to Wasm
$ spin registry push
$ spin kube deploy
Check out a full walkthru of creating and deploying Spin apps to Kubernetes.
This is what the YAML looks like for a simple Spin serverless app:
apiVersion: core.spinoperator.dev/v1alpha1
kind: SpinApp
metadata:
name: hello-spin
spec:
image: "ttl.sh/hello-spin:24h"
replicas: 2
When it is installed, the Spin operator in SpinKube transforms the above into the requisite set of Deployment
, Service
, Secret
and ConfigMap
resources necessary. And the Spin shim in Containerd schedules the Wasm binary onto the Spin runtime instead of the container runtime.
Note that while Spin applications are not packaged into Docker containers, almost all of the usual Kubernetes tools work with Spin, including service meshes, volume mounts, telemetry and observability tooling, and autoscalers.
Browse Chapters