---
title: "Deploy a Wasm Workload to Kubernetes | wasmCloud"
description: "Deploy a WebAssembly component to wasmCloud on Kubernetes — customize providers, write WorkloadDeployment manifests, and ship your app to production."
canonical: "https://wasmcloud.com/docs/quickstart/deploy-a-webassembly-workload/"
---

Version: v2

# Deploy a Wasm Workload to Kubernetes

In our previous tutorials, we started a developer loop and added the [`wasi:keyvalue`](https://wasmcloud.com/docs/overview/interfaces/) interface to our application. The `wash dev` process satisfied our application's capability requirements automatically, so we could move quickly and focus on code.

Now we'll learn how to:

- Compile your application to a WebAssembly component binary
- Publish your Wasm binary to an OCI registry
- Set up a wasmCloud environment on Kubernetes and deploy your Wasm workload

> **Prerequisites**
>
> This tutorial assumes you're following directly from the previous steps. Make sure to complete [**Quickstart**](https://wasmcloud.com/docs/quickstart/) and [**Develop a WebAssembly Component**](https://wasmcloud.com/docs/quickstart/develop-a-webassembly-component/) first.

## Build Wasm binary

**Rust**

Use the `wash build` command from the root of a project directory to compile the component into a `.wasm` binary:

shell

```shell
wash build
```

By default, the compiled `.wasm` binary for a Rust project is generated at `/target/wasm32-wasip2/release/`. The output path for the compiled `.wasm` binary [can be configured via `wash`'s `config.yaml` file](https://wasmcloud.com/docs/wash/config/).

**TypeScript**

Use the `wash build` command from the root of a project directory to compile the component into a `.wasm` binary:

shell

```shell
wash build
```

By default, the compiled `.wasm` binary for a TypeScript project is generated at `/dist/`. The output path for the compiled `.wasm` binary [can be configured via `wash`'s `config.yaml` file](https://wasmcloud.com/docs/wash/config/).

**My language isn't listed**

If you prefer working in a language that isn't listed here, let us know!

Loading...

## Publish image

Now we can publish a Wasm binary image to any OCI compliant registry that supports **OCI artifacts**.

> **What is this image?**
>
> The wasmCloud ecosystem uses the [OCI image specification](https://github.com/opencontainers/image-spec) to package Wasm components—these images are not container images, but conform to OCI standards and may be stored on any OCI-compatible registry. You can learn more about wasmCloud packaging on the [**Packaging**](https://wasmcloud.com/docs/overview/packaging/) page.

### Authenticate to registry

`wash` uses Docker credentials for OCI registry authentication. For GitHub Packages (GHCR), you'll need a [GitHub Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with `write:packages` scope. Authenticate with the `docker` CLI:

shell

```shell
docker login ghcr.io -u <username>
```

Docker will prompt you for your PAT as the password.

> **Note**
>
> Your GitHub username (and the namespace in image paths) must be **all lowercase**.

### Push image to registry

Now we'll push a Wasm component image to a registry. The example below uses GitHub Packages, but you can use any OCI compliant registry that supports OCI artifacts.

If you're following along using GitHub Packages, make sure to replace `<namespace>` in the command below with your own GitHub namespace (lowercase).

**Rust**

shell

```shell
wash oci push ghcr.io/<namespace>/http-hello-world:0.1.0 ./target/wasm32-wasip2/release/hello_world.wasm
```

**TypeScript**

shell

```shell
wash oci push ghcr.io/<namespace>/http-hello-world:0.1.0 ./dist/http_hello_world_hono.wasm
```

**My language isn't listed**

If you prefer working in a language that isn't listed here, let us know!

Loading...

- The registry address (including name and tag) is specified for the first option with `wash oci push`.
- The second option defines the target path for the component binary to push.

> **Warning**
>
> If you're using GitHub Packages, remember to [make the image public](https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility) in order to follow the steps below.

## Install wasmCloud on Kubernetes

Installation requires the following tools:

- [`kubectl`](https://kubernetes.io/docs/tasks/tools/#kubectl)
- [Helm](https://helm.sh/docs) v3.8.0+

For more information on running wasmCloud on Kubernetes, see [Kubernetes Operator](https://wasmcloud.com/docs/kubernetes-operator/).

Select your Kubernetes environment:

**Existing cluster**

If you already have a Kubernetes cluster, skip cluster creation. Verify your `kubectl` context is pointing to the right cluster:

shell

```shell
kubectl cluster-info
```

**kind**

[kind](https://kind.sigs.k8s.io/) runs Kubernetes nodes as Docker containers.

**Requirements:** [Docker](https://docs.docker.com/get-started/get-docker/) · [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)

> **Linux**
>
> On Linux, Docker may require `sudo` unless you've completed the [post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/) to run Docker as a non-root user.

The following command downloads a `kind-config.yaml` from the [`wasmCloud/wasmCloud`](https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/deploy/kind/kind-config.yaml) repository, starts a cluster with port 80 mapped for ingress, and deletes the config upon completion:

shell

```shell
curl -fLO https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/deploy/kind/kind-config.yaml && kind create cluster --config=kind-config.yaml && rm kind-config.yaml
```

**k3d**

[k3d](https://k3d.io/) runs a lightweight [k3s](https://k3s.io/) cluster inside Docker.

**Requirements:** [Docker](https://docs.docker.com/get-started/get-docker/) · [k3d](https://k3d.io/#installation)

> **Linux**
>
> On Linux, Docker may require `sudo` unless you've completed the [post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/) to run Docker as a non-root user.

The `--port` flag maps host port 80 to NodePort 30950 on the server node. The hello-world manifest used later in this tutorial exposes the workload as a `NodePort` Service on port 30950, so this maps the Wasm component directly to `localhost:80` without going through k3d's bundled Traefik LoadBalancer:

shell

```shell
k3d cluster create wasmcloud --port "80:30950@server:0"
```

If you'd prefer the `LoadBalancer` pattern more typical of k8s production deployments, see the [Expose a Workload via Kubernetes Service](https://wasmcloud.com/docs/recipes/expose-workload-via-kubernetes-service/#exposing-the-service-externally) recipe.

**k3s**

[k3s](https://k3s.io/) is a lightweight Kubernetes distribution. **Linux only.**

Install k3s:

shell

```shell
curl -sfL https://get.k3s.io | sh -
```

Configure `kubectl` to use the k3s cluster:

shell

```shell
mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $USER ~/.kube/config
```

Use Helm to install the wasmCloud operator:

> **Runtime Gateway (deprecated)**
>
> The tutorial below routes HTTP traffic through a Kubernetes Service whose EndpointSlice the operator manages directly. The earlier **Runtime Gateway** that proxied traffic to workloads is [deprecated](https://wasmcloud.com/docs/kubernetes-operator/operator-manual/helm-values/#gateway-deprecated) (since 2.0.3) and will be removed in a future release; the local-dev overlay (`values.local.yaml`) disables it by default.

**Existing cluster**

shell

```shell
helm install wasmcloud --version 2.13.0 oci://ghcr.io/wasmcloud/charts/runtime-operator \
  --namespace wasmcloud --create-namespace \
  -f https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/charts/runtime-operator/values.local.yaml
```

**kind**

The [`values.local.yaml`](https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/charts/runtime-operator/values.local.yaml) file configures each host's HTTP listener on port 80. The kind cluster config maps container port 30950 to host port 80, so any NodePort Service on port 30950 will be reachable at `localhost`:

shell

```shell
helm install wasmcloud --version 2.13.0 oci://ghcr.io/wasmcloud/charts/runtime-operator \
  --namespace wasmcloud --create-namespace \
  -f https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/charts/runtime-operator/values.local.yaml
```

**k3d**

The k3d cluster was started with host port 80 mapped to NodePort 30950 on the server node. That NodePort matches the `nodePort: 30950` in the hello-world Service applied later in this tutorial, so requests to `localhost:80` reach the workload directly:

shell

```shell
helm install wasmcloud --version 2.13.0 oci://ghcr.io/wasmcloud/charts/runtime-operator \
  --namespace wasmcloud --create-namespace \
  -f https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/charts/runtime-operator/values.local.yaml
```

**k3s**

k3s includes a built-in load balancer (Klipper) that binds `LoadBalancer` services to node ports:

shell

```shell
helm install wasmcloud --version 2.13.0 oci://ghcr.io/wasmcloud/charts/runtime-operator \
  --namespace wasmcloud --create-namespace \
  -f https://raw.githubusercontent.com/wasmCloud/wasmCloud/refs/heads/main/charts/runtime-operator/values.local.yaml
```

Wait for the deployment to be ready:

shell

```shell
kubectl rollout status deploy -l app.kubernetes.io/instance=wasmcloud -n wasmcloud
```

## Deploy Wasm workload

We'll deploy the Wasm application with two resources: a Kubernetes `Service` that receives HTTP traffic, and a [`WorkloadDeployment`](https://wasmcloud.com/docs/kubernetes-operator/crds/#workloaddeployment) that references the Service and tells the operator to schedule the component onto a host. The operator maintains an EndpointSlice for the Service pointing at the host pods running the workload, so standard Kubernetes DNS and routing reach the component directly.

> **wasmCloud security model**
>
> wasmCloud components are **deny-by-default**: a component cannot use any capability—HTTP, key-value storage, logging, or any other—unless the host is explicitly told to allow it. The `hostInterfaces` field in a workload manifest is the allowlist. Each entry names an interface package that the host will make available to the component. Any interface not listed is silently unavailable, regardless of what the component's WIT file imports.

Run the following script in your terminal to create a file called `deployment.yaml` containing both manifests.

**Existing cluster**

shell

```shell
cat > deployment.yaml << 'EOF'
apiVersion: v1
kind: Service
metadata:
  name: http-hello-world
spec:
  type: ClusterIP
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: http-hello-world
spec:
  replicas: 1
  template:
    spec:
      hostSelector:
        hostgroup: default
      kubernetes:
        service:
          name: http-hello-world
      components:
        - name: http-hello-world
          image: ghcr.io/<namespace>/http-hello-world:0.1.0
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
        - namespace: wasi
          package: keyvalue
          interfaces:
            - atomics
            - store
EOF
```

**kind**

shell

```shell
cat > deployment.yaml << 'EOF'
apiVersion: v1
kind: Service
metadata:
  name: http-hello-world
spec:
  type: NodePort
  ports:
    - port: 80
      protocol: TCP
      nodePort: 30950
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: http-hello-world
spec:
  replicas: 1
  template:
    spec:
      hostSelector:
        hostgroup: default
      kubernetes:
        service:
          name: http-hello-world
      components:
        - name: http-hello-world
          image: ghcr.io/<namespace>/http-hello-world:0.1.0
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: localhost
        - namespace: wasi
          package: keyvalue
          interfaces:
            - atomics
            - store
EOF
```

**k3d**

shell

```shell
cat > deployment.yaml << 'EOF'
apiVersion: v1
kind: Service
metadata:
  name: http-hello-world
spec:
  type: LoadBalancer
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: http-hello-world
spec:
  replicas: 1
  template:
    spec:
      hostSelector:
        hostgroup: default
      kubernetes:
        service:
          name: http-hello-world
      components:
        - name: http-hello-world
          image: ghcr.io/<namespace>/http-hello-world:0.1.0
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: localhost
        - namespace: wasi
          package: keyvalue
          interfaces:
            - atomics
            - store
EOF
```

**k3s**

shell

```shell
cat > deployment.yaml << 'EOF'
apiVersion: v1
kind: Service
metadata:
  name: http-hello-world
spec:
  type: LoadBalancer
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: http-hello-world
spec:
  replicas: 1
  template:
    spec:
      hostSelector:
        hostgroup: default
      kubernetes:
        service:
          name: http-hello-world
      components:
        - name: http-hello-world
          image: ghcr.io/<namespace>/http-hello-world:0.1.0
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: localhost
        - namespace: wasi
          package: keyvalue
          interfaces:
            - atomics
            - store
EOF
```

The manifest has two resources: a Kubernetes [custom resource](https://wasmcloud.com/docs/kubernetes-operator/crds/) (`WorkloadDeployment`) that describes the workload, and a standard `Service`. The fields to highlight in the `WorkloadDeployment`:

- `hostSelector.hostgroup`: Selects which pool of wasmCloud hosts runs this workload. The Helm chart installs a `default` host group whose pods are labelled `hostgroup: default`—this is the correct target for most deployments. Custom host groups can be created to isolate workloads or provide specialized capabilities.
- `kubernetes.service.name`: References the Service by name. The operator creates and maintains an EndpointSlice for this Service that points at the host pods running the workload, and registers the Service's DNS names (`http-hello-world`, `http-hello-world.default`, `http-hello-world.default.svc`) with the host's HTTP router. For local development, `config.host: localhost` is added so the component also answers requests whose `Host` header is `localhost`.
- `components.image`: Defines the registry address we will use to fetch our Wasm image.
- `hostInterfaces`: Declares which capability interfaces the host will make available to the component. **Without an explicit entry here, the component cannot access that capability.** Since the HTTP and key-value capabilities use [well-known built-in interfaces](https://wasmcloud.com/docs/overview/interfaces/), all we have to do is list them.

Open the file and update the image name with the correct registry address. If you're using GitHub Packages, that means replacing `<namespace>` with your GitHub namespace.

Now use `kubectl` to apply the manifest:

shell

```shell
kubectl apply -f deployment.yaml
```

Verify that the Wasm component is successfully deployed:

shell

```shell
kubectl get workloaddeployments
```

Use `curl` to invoke the Wasm workload with an HTTP request:

> **macOS with OrbStack**
>
> OrbStack manages port 80 on macOS, intercepting traffic before it reaches the cluster. Run a port-forward in a separate terminal:
>
> shell
>
> ```shell
> kubectl port-forward svc/http-hello-world 8080:80
> ```
>
> Then substitute `localhost:8080` for `localhost` in the hello-world command, and use `-H "Host: blobby.localhost.direct" http://localhost:8080/...` in place of `http://blobby.localhost.direct/...` in the Blobby commands further below.

shell

```shell
curl localhost
```

text

```text
Hello x1, World!
```

## Deploy the Blobby file server

Now let's deploy a more feature-rich example: **Blobby** ("Little Blobby Tables"), a simple file server that demonstrates the [`wasi:blobstore`](https://github.com/WebAssembly/wasi-blobstore) capability alongside `wasi:http`.

Because only one NodePort/LoadBalancer Service can claim the external port at a time, **delete the `http-hello-world` workload and its Service before deploying Blobby**:

shell

```shell
kubectl delete workloaddeployment http-hello-world
kubectl delete service http-hello-world
```

The Blobby manifest routes HTTP traffic on `blobby.localhost.direct`, a public DNS alias for `127.0.0.1`, so no `/etc/hosts` changes are needed. Apply the manifest below to deploy the [`blobby`](https://github.com/wasmCloud/wasmCloud/tree/main/examples/blobby) component alongside a Service of the appropriate type for your environment:

**Existing cluster**

shell

```shell
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: blobby
spec:
  type: ClusterIP
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: blobby
spec:
  replicas: 1
  template:
    spec:
      kubernetes:
        service:
          name: blobby
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: blobby.localhost.direct
        - namespace: wasi
          package: blobstore
          version: 0.2.0-draft
          interfaces:
            - blobstore
          config:
            buckets: blobby
      components:
        - name: blobby
          image: ghcr.io/wasmcloud/components/blobby:0.6.0
EOF
```

**kind**

shell

```shell
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: blobby
spec:
  type: NodePort
  ports:
    - port: 80
      protocol: TCP
      nodePort: 30950
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: blobby
spec:
  replicas: 1
  template:
    spec:
      kubernetes:
        service:
          name: blobby
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: blobby.localhost.direct
        - namespace: wasi
          package: blobstore
          version: 0.2.0-draft
          interfaces:
            - blobstore
          config:
            buckets: blobby
      components:
        - name: blobby
          image: ghcr.io/wasmcloud/components/blobby:0.6.0
EOF
```

**k3d**

shell

```shell
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: blobby
spec:
  type: LoadBalancer
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: blobby
spec:
  replicas: 1
  template:
    spec:
      kubernetes:
        service:
          name: blobby
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: blobby.localhost.direct
        - namespace: wasi
          package: blobstore
          version: 0.2.0-draft
          interfaces:
            - blobstore
          config:
            buckets: blobby
      components:
        - name: blobby
          image: ghcr.io/wasmcloud/components/blobby:0.6.0
EOF
```

**k3s**

shell

```shell
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: blobby
spec:
  type: LoadBalancer
  ports:
    - port: 80
      protocol: TCP
---
apiVersion: runtime.wasmcloud.dev/v1alpha1
kind: WorkloadDeployment
metadata:
  name: blobby
spec:
  replicas: 1
  template:
    spec:
      kubernetes:
        service:
          name: blobby
      hostInterfaces:
        - namespace: wasi
          package: http
          interfaces:
            - incoming-handler
          config:
            host: blobby.localhost.direct
        - namespace: wasi
          package: blobstore
          version: 0.2.0-draft
          interfaces:
            - blobstore
          config:
            buckets: blobby
      components:
        - name: blobby
          image: ghcr.io/wasmcloud/components/blobby:0.6.0
EOF
```

Verify the deployment:

shell

```shell
kubectl get workloaddeployments
```

Once running, open **[http://blobby.localhost.direct](http://blobby.localhost.direct)** in your browser to use the file manager UI:

![Blobby Storage Manager UI showing an uploaded file with Copy Link, Download, and Delete buttons](https://wasmcloud.com/assets/images/blobby-ui-b9be4feb6f78a414eae2b34f09b67f0e.webp)

You can also interact with the file server directly from the command line:

Upload a file:

shell

```shell
echo "Hello, wasmCloud!" > hello.txt
curl -H "Content-Type: text/plain" http://blobby.localhost.direct/hello.txt --data-binary @hello.txt
```

List all files:

shell

```shell
curl -X POST http://blobby.localhost.direct/
```

Download a file:

shell

```shell
curl http://blobby.localhost.direct/hello.txt
```

Delete a file:

shell

```shell
curl -X DELETE http://blobby.localhost.direct/hello.txt
```

## Clean up

To remove the deployments and their Services created in this tutorial:

shell

```shell
kubectl delete workloaddeployment http-hello-world blobby --ignore-not-found
kubectl delete service http-hello-world blobby --ignore-not-found
```

To tear down the cluster entirely:

**Existing cluster**

Remove the wasmCloud Helm release:

shell

```shell
helm uninstall wasmcloud
```

**kind**

shell

```shell
kind delete cluster
```

**k3d**

shell

```shell
k3d cluster delete wasmcloud
```

**k3s**

shell

```shell
k3s-uninstall.sh
```

## What's next?

- **Explore the interfaces:** Learn how [WASI interfaces](https://wasmcloud.com/docs/overview/interfaces/) work and browse the full list of built-in capabilities your components can use.
- **Go deeper with components:** The [Developer Guide](https://wasmcloud.com/docs/wash/developer-guide/) covers building, publishing, debugging, and composing components.
- **Deploy to production:** The [Operator Manual](https://wasmcloud.com/docs/kubernetes-operator/operator-manual/overview/) covers production topics: RBAC, private registries, and CI/CD pipelines.

Last updated on **Nov 9, 2026** by **Eric Gregory**
