Running WasmEdge Containers on Kubernetes with crun

Open Source
Date:November 26, 2026
Topic:
Running WasmEdge Containers on Kubernetes with crun
⏱ 3 min read

WebAssembly on the server isn't a science experiment anymore. It's a deployment target. If you're running Kubernetes, you can now schedule Wasm workloads right alongside standard Linux containers using the same tooling you already know: crun as the OCI runtime and containerd as the shim. No custom kubelet, no bespoke control plane, just a RuntimeClass and a few node labels.

Why WasmEdge on Kubernetes?

Cold starts in milliseconds. Near-native performance with a fraction of the attack surface. WasmEdge adds AOT compilation, POSIX-like system interfaces (WASI), and support for TensorFlow Lite and Rust async runtimes. For edge clusters, AI inference sidecars, or multi-tenant plugin systems, it changes the density equation entirely.

Prerequisites

You need a Kubernetes cluster (v1.25+), containerd v1.6+ configured with the CRI plugin, and nodes running a kernel >= 5.10 (for memfd_create and landlock support). Install crun >= 1.8 and wasmedge >= 0.13 on every worker node.

bash
# On each worker node (Ubuntu example)
sudo apt-get update && sudo apt-get install -y crun wasmedge
# Verify
crun --version
wasmedge --version

Configure containerd for WasmEdge

Edit /etc/containerd/config.toml to register a new runtime handler pointing at crun with the WasmEdge annotation.

toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmedge]
  runtime_type = "io.containerd.runc.v2"
  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmedge.options]
    BinaryName = "/usr/bin/crun"
    SystemdCgroup = true
    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmedge.options.RuntimeArgs]
      - "--annotation"
      - "module.wasm.image/variant=wasmedge"
💡
TipRestart containerd after changes: <code>systemctl restart containerd</code>.

Define the RuntimeClass

Create a RuntimeClass so the scheduler knows which nodes can run Wasm workloads.

yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
handler: wasmedge
metadata:
  name: wasmedge
scheduling:
  nodeSelector:
    kubernetes.io/arch: "amd64"
    runtime.wasmedge/enabled: "true"
  tolerations:
  - effect: NoSchedule
    key: "runtime.wasmedge/tolerate"
    operator: "Exists"

Label Your Nodes

Taint or label nodes that have the WasmEdge binary installed. This prevents pods from landing on nodes without the runtime.

bash
kubectl label node <node-name> runtime.wasmedge/enabled=true
kubectl taint node <node-name> runtime.wasmedge/tolerate=:NoSchedule

Build a Wasm Container Image

Compile your code (Rust, Go, C++) to wasm32-wasi. Package the .wasm file into a scratch image using a Dockerfile that sets the required annotation.

dockerfile
FROM scratch
COPY target/wasm32-wasi/release/my-app.wasm /app.wasm
ENTRYPOINT ["/app.wasm"]
# Annotation is added at push time via buildx or crane

Push with the annotation so crun picks the right engine:

bash
crane mutate myreg/my-app:latest \
  -a module.wasm.image/variant=wasmedge \
  -t myreg/my-app:wasmedge

Deploy the Pod

Reference the RuntimeClass in your pod spec. The kubelet hands off to containerd, which invokes crun --annotation module.wasm.image/variant=wasmedge, launching WasmEdge.

yaml
apiVersion: v1
kind: Pod
metadata:
  name: wasmedge-demo
spec:
  runtimeClassName: wasmedge
  containers:
  - name: app
    image: myreg/my-app:wasmedge
    resources:
      limits:
        cpu: "500m"
        memory: "128Mi"

Observability and Debugging

Standard kubectl logs and kubectl exec work. WasmEdge writes stdout/stderr normally. For profiling, enable WASMEDGE_LOG=debug in the container env. Metrics scrape via Prometheus annotations just like any other pod.

"

The container image becomes a capability token, not a filesystem snapshot.

— Solomon Hykes

Next Steps

Start with a sidecar: move your auth proxy or metrics transformer to WasmEdge. Measure cold-start latency and memory footprint. Then expand to full services. The tooling is stable; the architecture shift is the only blocker.

⚠️
WarningEnsure your kernel supports <code>landlock</code> (5.13+) for proper sandboxing. Older kernels fall back to seccomp-only isolation.

✦

Clone the WasmEdge repo, spin up a kind cluster with the containerd config above, and deploy the sample wasmedge-quickstart image. You'll have a Wasm pod running in under five minutes.

Share𝕏 Twitterin LinkedInin Whatsapp