k8s
HTTP Server
Run a daemon HTTP server in WASM via the Kubernetes operator
This runs the HTTP server WASM module — a wasi:http/proxy component that serves HTTP on a configurable port — through the Propeller Kubernetes operator. This is a daemon task that runs indefinitely.
Prerequisites
The operator must be deployed and a Proplet registered. Follow the end-to-end example first.
Proplet Configuration
Enable the WASI HTTP proxy:
kubectl patch proplet k8s-proplet --type=merge -p '{"spec":{"k8s":{"env":{"httpEnabled":true}}}}'Build the WASM Module
cd propeller
make http-serverApply the Task
WASM_B64=$(base64 -w0 propeller/build/http-server.wasm)
kubectl apply -n propeller-workloads -f - <<EOF
apiVersion: propeller.propeller.absmach.eu/v1
kind: Task
metadata:
name: http-server-example
spec:
name: http-server-example
functionName: _start
file: "${WASM_B64}"
cliArgs:
- "--port"
- "8044"
daemon: true
propletSelector:
propletId: "k8s-proplet"
EOFVerify
A daemon task never reaches a terminal phase — it stays in running. Verify via proplet logs:
kubectl logs -n propeller-workloads deployment/k8s-proplet | grep "http-server"To test the server, port-forward the proplet pod and curl it:
kubectl port-forward -n propeller-workloads pod/<proplet-pod> 8044:8044 &
curl -iX GET "http://localhost:8044"
curl -iX POST "http://localhost:8044/echo" -d "hello"Expected responses:
# GET /
Hello from proplet WASM HTTP server!
# POST /echo
helloReference
| Field | Value |
|---|---|
functionName | _start |
cliArgs | ["--port", "8044"] |
daemon | true |
| Proplet env | httpEnabled: true |