Rust Applications in Containers, Kubernetes and WebAssembly
Learn essentials when it comes to running Rust applications in containers, Kubernetes and leveraging WebAsembly (Wasm) and WASI in Kubernetes using containerd-wasm-shim and Fermyon Spin.
Images • Use proper tagging strategy • Embrace multi-stage Dockerfiles • Run apps in a non-previliged user context • Expect the root-filesystem to be readonly Containerizing Rust Applications
• Containerizing Rust applications may require more up-front thinking compared to contaienrizing apps build using other languages • Static vs dynamic C runtimes • for ref see https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes Containerizing Rust Applications
log to STDOUT / STDERR • Hosting aspects (e.g., HTTPs redirections) are not in the responsibility of the app developer • Consume configuration using environment variables or files mounted into the container at runtime Running Rust Applications in Kubernetes
metrics and traces using OpenTelemetry (https://opentelemetry.io/) • Provide health probes (readiness & liveness at least) • Specify resource requests & limits for every container Running Rust Applications in Kubernetes
made in Rust to run WebAssembly Modules using wasmtime • Now we have containerd-shim in preview • Run Spin and Slight applications WebAssembly workloads in Kubernetes
• Limitations & gotchas • Supporting only simple workloads for now (HTTP) • Scratch Container is used for distribution WebAssembly workloads in Kubernetes
and running event-driven microservice applications with WebAssembly (Wasm) components. With Spin, we’re trying to make it easier to get started with using WebAssembly on the server so that we can all take advantage of the security, portability, and speed WebAssembly provides when it comes to running microservices.” WebAssembly workloads in Kubernetes https://developer.fermyon.com/spin/index