{"id":18328324,"url":"https://github.com/thorstenhans/webassembly-beyond-the-browser","last_synced_at":"2025-04-09T16:54:00.629Z","repository":{"id":143345211,"uuid":"537538438","full_name":"ThorstenHans/WebAssembly-beyond-the-browser","owner":"ThorstenHans","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-16T16:34:36.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T10:17:24.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThorstenHans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-16T16:34:26.000Z","updated_at":"2022-11-22T15:57:29.000Z","dependencies_parsed_at":"2023-06-09T16:00:10.002Z","dependency_job_id":null,"html_url":"https://github.com/ThorstenHans/WebAssembly-beyond-the-browser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2FWebAssembly-beyond-the-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2FWebAssembly-beyond-the-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2FWebAssembly-beyond-the-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2FWebAssembly-beyond-the-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThorstenHans","download_url":"https://codeload.github.com/ThorstenHans/WebAssembly-beyond-the-browser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248073852,"owners_count":21043474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T19:13:46.050Z","updated_at":"2025-04-09T16:54:00.607Z","avatar_url":"https://github.com/ThorstenHans.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A quick look at krustlet\n\nThis repo contains fundamental WebAssembly (Wasm) workloads that could be executed on [krustlet](https://krustlet.dev).\n\n## Setup\n\n- obviously, you must have a krustlet running. You can add krustlet to different Kubernetes distributions and managed Kubernetes services.\n- an OCI distribution spec compliant Container Registry (e.g. Azure Container Registry) is required. We will use it as distribution channel for our Wasm workloads\n- `wasm32-wasi` must be installed as target (`rustup target add wasm32-wasi`)\n- Workloads must be compiled against the `wasm32-wasi` using `cargo build --release --target wasm32-wasi`\n\n## Azure Container Registry Authentication\n\nEnsure your instance of ACR allows anonymous image pulling (required if you want to run the WAGI workload on AKS)\n\n```bash\nacrName=foo\nrgName=foo-bar\n\naz acr update -n $acrName -g $rgName --anonymous-pull-enabled\n```\n\n## Verify krustlet taints\n\nDepending on your environment you may find different `taints` being assigned to the krustlet nodes. Verify if your taints are `wasm32-wasi` or `wasm32-wagi`:\n\n```bash\n\n# get all nodes in your cluster\n\nkubectl get nodes\n\nNAME                 STATUS     ROLES                  AGE    VERSION\nkind-control-plane   Ready      control-plane,master   103m   v1.21.1\nfoobar               Ready      \u003cnone\u003e                 39m    1.0.0-alpha.1\n\n\n# get node taints\nkubectl describe node foobar\n\n# omitted\nTaints: kubernetes.io/arch=wasm32-wasi:NoExecute\n        kubernetes.io/arch=wasm32-wasi:NoSchedule\n# omitted\n```\n\nNote down the `arch`, you must specify it as part of the Pods `tolerations` (see `pod.yml` in both samples -\u003e `podSpec.tolerations`)\n\n## Publishing Wasm modules to Azure Container Registry (ACR)\n\nAssuming having access to an ACR instance called `foobar`, we must push both Wasm modules (`hello-krustlet` and `hello-wasi`) to the ACR instance. To do so, we use [wasm-to-oci](https://github.com/engineerd/wasm-to-oci)\n\n```bash\n# authenticate against ACR (either use Azure CLI or use Docker CLI)\naz acr login -n foobar\n\ncd 001-wasm\ncargo build --release --target wasm32-wasi\n\nwasm-to-oci push ./target/wasm32-wasi/release/hello-wasm.wasm foobar.azurecr.io/hello-wasm:0.0.1\ncd ..\n\ncd 002-wasi\ncargo build --release --target wasm32-wasi\n\nwasm-to-oci ./target/wasm32-wasi/release/hello-wasi.wasm foobar.azurecr.io/hello-wasi:0.0.1\n\ncd ..\n\ncd 003-wagi\ncargo build --release --target wasm32-wasi\n\nwasm-to-oci ./target/wasm32-wasi/release/hello-wasi.wasm foobar.azurecr.io/hello-wagi:0.0.1\n\n```\n\n## Running hello-wasm in KIND\n\n1. Ensure your `kubectl context` points to your KIND cluster\n2. Ensure you've attached krustlet to your KIND cluster (see [scripts](./scripts) folder)\n\nYou can run `hello-wasm` by applying the Kubernetes manifest located in the kubernetes subfolder:\n\n```bash\nkubectl apply -f ./001-wasm/kubernetes/pod.yml\n```\n\n### Running hello-wasm locally\n\nYou can run `hello-wasm` locally using any (non-browser) WASM runtime. The following sample uses `wasmtime`:\n\n```bash\ncd 001-wasm\ncargo build --release --target wasm32-wasi\nwasmtime run ./target/wasm32-wasi/release/hello-wasm.wasm\n```\n\n## Running hello-wasi in KIND\n\n1. Ensure your `kubectl context` points to your KIND cluster\n2. Ensure you've attached krustlet to your KIND cluster (see [scripts](./scripts) folder)\n3. Update the `volume` in [pod.yml](./002-wasi/kubernetes/pod.yml) and provide a valid folder on your system\n\nYou can run `hello-wasi` by applying the Kubernetes manifest located in the kubernetes subfolder:\n\n```bash\nkubectl apply -f ./002-wasi/kubernetes/pod.yml\n```\n\n### Running hello-wasi locally\n\nYou can run `hello-wasi` locally using any (non-browser) WASM runtime. The following sample uses `wasmtime`:\n\n```bash\ncd 002-wasi\ncargo build --release --target wasm32-wasi\nwasmtime run --dir /some/dir --env TARGET=/same/dir ./target/wasm32-wasi/release/hello-wasi.wasm\n```\n\n## Running 003-wagi in AKS\n\n1. Ensure your `kubectl context` points to AKS\n2. Ensure WASM Node Pool is provisioned (see [scripts](./scripts) folder)\n3. Install NGINX ingress which points to WasmWasi Node Ip (see [scripts](./scripts) folder)\n\n```bash\nkubectl apply -f ./003-wagi/kubernetes/pod.yml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Fwebassembly-beyond-the-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthorstenhans%2Fwebassembly-beyond-the-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Fwebassembly-beyond-the-browser/lists"}