Does Wasm Replace Kubernetes? How SpinKube Runs It
F8010’s article presents server-side WebAssembly (Wasm) as a candidate for the next Kubernetes. Yet SpinKube, a project for deploying Wasm apps, runs on Kubernetes. SpinKube changes how an app runs on the node. Kubernetes still places Pods and connects them through Services.
This is not a hands-on deployment or a performance benchmark. It traces the default shim execution path using official documentation and the Spin Operator implementation.
Figure: Two execution paths on the same Kubernetes cluster. Original illustration based on the SpinKube architecture.
Kubernetes, Wasm, and WASI serve different roles
Section titled “Kubernetes, Wasm, and WASI serve different roles”Kubernetes manages which apps should run, how many copies should exist, and where their Pods should run. Wasm is an execution format for application code. WASI (WebAssembly System Interface) defines interfaces for Wasm programs to use host capabilities. Building an app as Wasm does not mean all its existing Linux file or network calls will work unchanged. The app and runtime must support the relevant interfaces, and the host must grant access.
Packaging is a separate concern. A Spin app can reference an artifact in an OCI registry, as the Quickstart shows. It can use the same registry as container images without following the same execution path on the node.
From SpinApp to running Wasm
Section titled “From SpinApp to running Wasm”With the Quickstart’s containerd-shim-spin executor, the control and execution paths break down as follows.
Figure: The control path, node execution path, and HTTP request path. Original diagram based on the Spin Operator v0.6.1 implementation and Kubernetes CRI documentation.
- Reconcile the resources. The
SpinAppspecifies the application artifact and executor. The Spin Operator reads the shim executor configuration and creates or updates the Deployment and Service. A ReplicaSet managed by the Deployment creates Pods, and the Kubernetes scheduler selects their nodes. - Select the execution path on the node. The Pod’s
runtimeClassNamereferences a RuntimeClass. The Quickstart’swasmtime-spin-v2specifies thespinhandler. When kubelet requests execution from containerd over CRI, containerd uses the Spin shim configured for that handler. RuntimeClass provides selection information. It does not install the shim on a node. - Run the app and serve requests.
containerd-shim-spinintegrates the Spin app into the runtime path. Spin executes the Wasm component. HTTP requests reach the app in a ready Pod through the Service, not through the Operator.
What stays the same and what changes
Section titled “What stays the same and what changes”| Concern | Standard container | SpinKube shim path |
|---|---|---|
| Placement and networking | Kubernetes places Pods and connects them through Services. | The same Kubernetes resources are used, and the Spin Operator configures the app’s resources. |
| App execution on the node | The node’s container runtime starts a container process. | Kubelet and containerd remain in the path. The Spin shim and Spin run the Wasm component. |
| Deployment artifact | The container image packages the app and the files it needs to run. | A Spin app can be distributed as an OCI artifact. |
| Host capabilities | The app uses OS features and libraries available to the container. | Check whether the runtime implements the app’s required interfaces and whether the host grants access. |
What to check before switching
Section titled “What to check before switching”A stateless HTTP handler with few dependencies is a reasonable candidate. If the existing app depends on specific OS features or native libraries, check whether those dependencies can be ported before comparing artifact sizes. The cluster still needs the Spin shim installed on suitable nodes, and those nodes still need operating. CNCF classifies SpinKube as a Sandbox project. That is a project maturity designation, not a guarantee of suitability for a particular service.
The runtime startup time cited in the original article is also different from the time until a client gets its first successful HTTP response. The latter can include fetching artifacts, placing the Pod, and waiting for the app to become ready. A comparison should separate first-time pulls from runs with artifacts already available. SpinKube illustrates a different way to execute apps while keeping the Kubernetes placement model, not Wasm replacing Kubernetes.