Last active
March 21, 2024 17:27
-
-
Save 0xE282B0/9b8211c8c42e1408b9f00d83eab38d79 to your computer and use it in GitHub Desktop.
A short code listing to run WasmEdge container on AWS Kubernetes with Ubuntu nodes
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
# Currently only AWS AKS cluster with Ubuntu worker nodes are supported by KWasm. | |
eksctl create cluster --name wasm-eks --node-type=t3.medium --without-nodegroup --version=1.23 | |
# ATENTION, you need to choose the right region and ami | |
# Look up the appropriate ami for your region: https://cloud-images.ubuntu.com/locator/ec2/ | |
echo 'apiVersion: eksctl.io/v1alpha5 | |
kind: ClusterConfig | |
metadata: | |
name: wasm-eks | |
region: us-west-2 | |
managedNodeGroups: | |
- name: ng-wasm-eks | |
ami: ami-0809c110f957a5eb8 | |
instanceType: t3.medium | |
minSize: 1 | |
maxSize: 2 | |
overrideBootstrapCommand: | | |
#!/bin/bash | |
/etc/eks/bootstrap.sh wasm-eks --container-runtime containerd' | eksctl create nodegroup -f - | |
# --- | |
# 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 | |
# Add runtime class for crun | |
echo 'apiVersion: node.k8s.io/v1 | |
kind: RuntimeClass | |
metadata: | |
name: crun | |
handler: crun' | kubectl apply -f - | |
# Run wasm image | |
echo 'apiVersion: v1 | |
kind: Pod | |
metadata: | |
annotations: | |
module.wasm.image/variant: compat-smart | |
labels: | |
run: wasi-demo | |
name: wasi-demo | |
spec: | |
containers: | |
- args: | |
- /wasi_example_main.wasm | |
- "50000000" | |
image: wasmedge/example-wasi:latest | |
name: wasi-demo | |
runtimeClassName: crun | |
restartPolicy: Never' | kubectl apply -f - | |
# Output logs | |
kubectl logs wasi-demo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment