Skip to content

Does Wasm Replace Kubernetes? How SpinKube Runs It

Interactive Diagram

새 탭 ↗

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.

Concept illustration of standard containers and Spin Wasm apps taking different execution paths within the same Kubernetes cluster

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.

With the Quickstart’s containerd-shim-spin executor, the control and execution paths break down as follows.

SpinApp and Spin Operator configure a Deployment and Service, while kubelet and containerd run Wasm through the Spin shim

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.

  1. Reconcile the resources. The SpinApp specifies 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.
  2. Select the execution path on the node. The Pod’s runtimeClassName references a RuntimeClass. The Quickstart’s wasmtime-spin-v2 specifies the spin handler. 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.
  3. Run the app and serve requests. containerd-shim-spin integrates 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.
ConcernStandard containerSpinKube shim path
Placement and networkingKubernetes 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 nodeThe 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 artifactThe container image packages the app and the files it needs to run.A Spin app can be distributed as an OCI artifact.
Host capabilitiesThe 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.

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.