Rust is the most mature programming language that can generate WebAssembly modules: WebAssembly is a first-class citizen in the Rust world. That means many of the tools and crates of the Rust ecosystem work out of the box.
Kubewarden provides a Rust SDK
that simplifies the process of writing policies, plus a
template project to
quickly scaffold a policy project using the
This document illustrates how to take advantage of these projects to write Kubewarden policies using the Rust programming language.
Note well, we won't cover the details of Kubewarden's Rust SDK inside of this page. These can be found inside of the official crate documentation.
Getting Rust dependencies
This section guides you through the process of installing the Rust compiler and its dependencies.
As a first step install the Rust compiler and its tools, this can be easily done using rustup. Please follow rustup's install documentation.
rustup is installed add the WASI target:
rustup target add wasm32-wasi
OSX specific dependencies
In order to use
cargo-generate you will need to add the Xcode tool set. If it isn't installed through Xcode the following command will give you the dependencies needed: