How to run WebAssembly components on Kubernetes with wasmCloud
WebAssembly components are made for cloud native environments:
- As WebAssembly binaries, components are truly agnostic to OS and architecture.
- Teams can compile components from their language of choice, then combine and interoperate—across languages—with other components via standard APIs. It's like building blocks.
- Components are orders of magnitude more efficient than containers, setting the stage for major cost, speed, and sustainability improvements.
With components, teams can write code in the language of their choice and run it anywhere...including in places where even containers are impractical. If your organization is already using Kubernetes, it's easy to run components on your clusters with wasmCloud. In fact, wasmCloud can help you extend Kubernetes to tackle traditional challenge areas like multi-cloud and edge.
In this tutorial, you'll learn how to get started running WebAssembly components on Kubernetes in three simple steps. The whole process should only take about five minutes.
How does wasmCloud work with Kubernetes?
At a high level you can think of wasmCloud is as Kubernetes for WebAssembly. We describe it as a "Wasm-native orchestrator": a distributed applications platform built from the ground up for WebAssembly workloads.
Because wasmCloud is tailored specifically to WebAssembly, it can take advantage of components' distinctive efficiency, interoperability, and composability. While you can run wasmCloud standalone, most teams don't want to replace their entire infrastructure. Kubernetes is very good at abstracting and managing the infrastructure side of the equation—wasmCloud sits on that foundation and focuses on orchestrating distributed applications.
On a technical level, wasmCloud integrates with Kubernetes through an operator. Once you install the operator on your Kubernetes cluster, you can...
- Deploy wasmCloud hosts on the cluster. At a high level, you can think of a host as a runtime environment that loads, runs, and communicates between the different parts of your application.
- Deploy wasmCloud applications to the cluster straight from
kubectl
. In wasmCloud, applications are defined in YAML manifests with the OAM specification. The manifests will look familiar to Kubernetes users—better yet, you can deploy them to the cluster the same way you would any other Kubernetes resource.
What does all of this mean in practice?
- Developers can move faster, reusing building blocks written against well-known APIs.
- It's easy to run distributed apps in resource-constrained environments at the edge.
- You can use wasmCloud's connectivity layer to connect Kubernetes clusters across different clouds or regions.
- Workloads can be scheduled dynamically across regions and clouds.
By unlocking the power of distributed components, wasmCloud extends Kubernetes as well. Let's jump in and see how it works.
Get started with wasmCloud on Kubernetes
In this tutorial, we'll get wasmCloud up and running on a local Kubernetes cluster. You'll need Helm and a Kubernetes cluster running on your machine. It also helps to install wasmCloud Shell (wash
), though it's not strictly necessary.
A wasmCloud installation requires a few things to run:
- NATS (with Jetstream enabled)
- wasmCloud Application Deployment Manager (wadm) connected to NATS
If you're not sure what that means, don't worry: the following steps will help you deploy the prerequisites to your Kubernetes cluster, then deploy the operator.