Created
October 24, 2022 19:46
-
-
Save 0xE282B0/aff95f4158f14971ab52b18a918a2e39 to your computer and use it in GitHub Desktop.
A short code listing to run spin on DigitalOcean Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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