Running WebAssembly with ContainerD + CRUN + WasmEdge


WebAssembly (Wasm) isn’t just for the browser anymore. It’s conquering the cloud too — and if you're feeling adventurous, let's plug it into container runtimes like
containerd
, run it withcrun
, and power up workloads in Kubernetes like a boss. Oh, and yes — we'll even touch on KubeVirt to show Wasm's flexibility in a virtualized world.
🛠️ Step 1: Install WasmEdge (The Wasm Runtime Hero)
Let’s kick things off by installing WasmEdge — a blazing-fast Wasm runtime optimized for cloud-native.
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
source $HOME/.wasmedge/env
✅ Verify Installation
wasmedge --version
Expected output:
wasmedge version 0.13.5
Now that you’re equipped with Wasm superpowers, let’s bring in the container orchestration party.
🧱 Step 2: Set Up ContainerD, CRUN, and Kubernetes
One-liner to install everything you need:
wget -qO- https://raw.githubusercontent.com/sonichigo/wasmedge-demo-example/main/install.sh | bash
This script handles:
Installing
containerd
Configuring
crun
as the runtimePatching containerd for Wasm support
Setting up a local Kubernetes cluster
Expected terminal logs include:
> Installing ContainerD and CRUN
<==============================>
...
Local Kubernetes cluster is running. Press Ctrl-C to shut it down.
Boom. That’s your Wasm-ready k8s cluster firing up 🎉
☁️ Step 3: Run a Wasm Container in Kubernetes
Switch into Kubernetes source and set up your config:
cd kubernetes && git checkout v1.22.4
export KUBERNETES_PROVIDER=local
sudo cluster/kubectl.sh config set-cluster local --server=https://localhost:6443 --certificate-authority=/var/run/kubernetes/server-ca.crt
sudo cluster/kubectl.sh config set-credentials myself --client-key=/var/run/kubernetes/client-admin.key --client-certificate=/var/run/kubernetes/client-admin.crt
sudo cluster/kubectl.sh config set-context local --cluster=local --user=myself
sudo cluster/kubectl.sh
Check cluster status:
sudo cluster/kubectl.sh cluster-info
You should see your cluster nodes happily registered.
🌐 Step 4: Deploy a WebAssembly HTTP Service
Time to run a Wasm image in the cluster!
sudo cluster/kubectl.sh run --restart=Never http-server \
--image=wasmedge/example-wasi-http:latest \
--annotations="module.wasm.image/variant=compat-smart" \
--overrides='{"kind":"Pod", "apiVersion":"v1", "spec": {"hostNetwork": true}}'
Then hit it with:
curl -d "name=WasmEdge" -X POST http://127.0.0.1:1234
Expected output:
echo: name=WasmEdge
🥳 Success! You just ran a Wasm container natively in Kubernetes.
🧪 Bonus: Run This on KubeVirt!
Want to get even fancier? Try this in a KubeVirt virtualized environment. Since KubeVirt can run Kubernetes inside virtual machines, you can embed this Wasm-ready containerd setup inside those VMs — making it super versatile for hybrid environments and edge deployments.
Steps are similar, but inside a KubeVirt VM with Ubuntu or Fedora base image. After that, follow this same guide within that VM and enjoy full Wasm-k8s magic, powered by KubeVirt's virtualization layer.
3 Ways to Run WASM with OCI & Container Runtimes
There’s more than one way to cook this goose. Here's a breakdown of the 3 main approaches:
🧩 With containerd-shim
(runwasi)
Detects Wasm images via target platform (
wasm32
)Uses
runwasi
for Wasm,runc
for regular containersBacked by Docker, Microsoft
Powering Docker+WASM preview releases
⚙️ Option #2: With crun
A C-based OCI runtime (from Red Hat)
Detects Wasm via annotations (
module.wasm.image/variant
)Supports full k8s stack: CRI-O, containerd, Podman, kind, microk8s
🦀 Option #3: With youki
A Rust-based OCI runtime
Also annotation-based detection
Can power CRI-O, containerd, Podman, kind, microk8s, and k8s
All of these can be visualized via their respective integration diagrams — worth including one if you're making this into a slide deck or dev talk!
🔚 Final Thoughts
WebAssembly isn’t the future - it’s the present. With WasmEdge, CRUN, and Kubernetes (even in KubeVirt), we now have the flexibility to run lightweight, fast, and secure applications anywhere. Whether you're targeting the cloud, the edge, or somewhere in between — you’re set up for success.
5 FAQs
1. Why use Wasm instead of Linux containers?
Wasm provides faster startup, smaller size, and better isolation — ideal for microservices and edge computing.
2. Do I need to change my Kubernetes setup to run Wasm?
Nope! With runtimes like crun
or youki
and proper annotations, it plugs right into your existing Kubernetes flow.
3. What languages can I use to build Wasm apps?
Rust, Go (with TinyGo), C/C++, Python (via Pyodide), and even JavaScript!
4. Can I run Wasm apps alongside Linux containers?
Yes, mixed workloads are totally supported — just annotate your Wasm images and the runtime handles the rest.
5. How does this differ from running containers in Docker?
Docker (via containerd) supports Wasm via runwasi
, but this approach goes deeper into Kubernetes and custom runtime integrations using crun
/youki
.
Subscribe to my newsletter
Read articles from Animesh Pathak directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Animesh Pathak
Animesh Pathak
Animesh Pathak is a Developer Relations professional passionate about APIs, testing, and open-source development. As an advocate for Keploy, he actively engages with developer communities, creating content and fostering collaboration to improve testing workflows. Animesh has contributed to various projects and spoken at developer-focused events, sharing insights on API testing, automation, and the evolving DevOps landscape. He thrives on building meaningful connections, whether through technical content, community initiatives, or hands-on mentorship, always striving to make an impact in the developer ecosystem!