Skip to content

Instantly share code, notes, and snippets.

@0xE282B0
Created October 24, 2022 19:46
Show Gist options
  • Save 0xE282B0/aff95f4158f14971ab52b18a918a2e39 to your computer and use it in GitHub Desktop.
Save 0xE282B0/aff95f4158f14971ab52b18a918a2e39 to your computer and use it in GitHub Desktop.
A short code listing to run spin on DigitalOcean Kubernetes
doctl kubernetes cluster create kwasm
# Takes some time ...
doctl kubernetes cluster kubeconfig save kwasm
# Install KWasm operator
helm repo add kwasm http://kwasm.sh/kwasm-operator/
helm install -n kwasm --create-namespace kwasm-operator kwasm/kwasm-operator
# Provision Nodes
kubectl annotate node --all kwasm.sh/kwasm-node=true
# Jump into step 3 and 4 of containerd-wasm-shims https://github.com/deislabs/containerd-wasm-shims#using-a-shim-in-kubernetes
echo ' apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: wasmtime-spin
handler: spin' | kubectl apply -f -
echo ' apiVersion: apps/v1
kind: Deployment
metadata:
name: wasm-spin
spec:
replicas: 1
selector:
matchLabels:
app: wasm-spin
template:
metadata:
labels:
app: wasm-spin
spec:
runtimeClassName: wasmtime-spin
containers:
- name: spin-hello
image: ghcr.io/deislabs/containerd-wasm-shims/examples/spin-rust-hello:latest
command: ["/"]
' | kubectl apply -f -
# Finally test the hello spin app 🥳
kubectl port-forward deployment/wasm-spin 8000:80&
curl localhost:8000/hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment