This example shows how to use CloudEvents with WebAssembly WASI and Krustlet
Add a Krustlet node to your local Kubernetes cluster
$ git clone https://github.com/krustlet/krustlet.git
$ cd krustlet
$ scripts/bootstrap.sh
$ KUBECONFIG=~/.krustlet/config/kubeconfig target/debug/krustlet-wasi --port 3000 --bootstrap-file ~/.krustlet/config/bootstrap.conf
Build this example and make it target wasm32-wasi
target.
rustup target add wasm32-wasi
cargo build --target wasm32-wasi --release
Now we need to create an OCI image from our binary
wasm-to-oci push target/wasm32-wasi/release/ce-wasi-example.wasm ghcr.io/dejanb/ce-wasi-example:latest
You can deploy this image to the K8s cluster with an example shown in [k8s.yaml]
kubectl apply -f k8s.yaml
Check if the workload is running correctly
kubectl logs -f -p ce-wasi-example
or
stern ce-wasi-example
Recording of a demo is available at https://www.youtube.com/watch?v=KBFh_X2N2vA