{"id":18328392,"url":"https://github.com/thorstenhans/krustlet-at-rust-linz","last_synced_at":"2025-06-15T11:35:10.868Z","repository":{"id":143345175,"uuid":"431944583","full_name":"ThorstenHans/krustlet-at-rust-linz","owner":"ThorstenHans","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-25T18:38:22.000Z","size":4,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T10:17:38.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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":"2021-11-25T18:38:00.000Z","updated_at":"2022-02-18T16:06:34.000Z","dependencies_parsed_at":"2023-06-09T16:00:28.727Z","dependency_job_id":null,"html_url":"https://github.com/ThorstenHans/krustlet-at-rust-linz","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%2Fkrustlet-at-rust-linz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Fkrustlet-at-rust-linz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Fkrustlet-at-rust-linz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThorstenHans%2Fkrustlet-at-rust-linz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThorstenHans","download_url":"https://codeload.github.com/ThorstenHans/krustlet-at-rust-linz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074273,"owners_count":21043480,"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:58.994Z","updated_at":"2025-04-09T16:55:03.554Z","avatar_url":"https://github.com/ThorstenHans.png","language":"Rust","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## Container Registry Authentication\n\nAuthentication information for the container registry must be persisted in the desired Kubernetes Namespace. You can use the following snippet to persist such an authentication information:\n\n```bash\nregLoginServer=foo.azurecr.io\nregUser=bob\nregPassword=bob\nk8sNamespace=default\n\nkubectl create secret docker-registry acr \\\n  --docker-username $regUser \\\n  --docker-server $regLoginServer \\\n  --docker-password $regPassword\n  --namespace $k8sNamespace\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 hello-krustlet\ncargo build --release --target wasm32-wasi\n\nwasm-to-oci ./target/wasm32-wasi/release/hello-krustlet.wasm foobar.azurecr.io/hello-krustlet:0.0.1\ncd ..\n\ncd hello-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\n```\n\n## Running hello-krustlet\n\nYou can run `hello-krustlet` by applying the Kubernetes manifest located in the kubernetes subfolder:\n\n```bash\nkubectl apply -f ./hello-krustlet/kubernetes/pod.yml\n```\n\n## Running hello-krustlet\n\nYou can run `hello-krustlet` locally using any (non-browser) WASM runtime. The following sample uses `wasmtime`:\n\n```bash\ncd hello-krustlet\ncargo build --release --target wasm32-wasi\n\nwasmtime run ./target/wasm32-wasi/release/hello-krustlet.wasm\n```\n\n## Running hello-wasi in KIND\n\nBefore running `hello-wasi`, you must configure the persistent volume used in the pod spec `podSpec.volumes[0]`.\n\nThe WASI sample will issue a system call (create a file). You must allow the module to write to the desired location (`/mnt/data` -\u003e see `podSpec.containers[0].env` and `podSpec.containers[0].volumeMounts[0]`)\nYou can run `hello-krustlet` by applying the Kubernetes manifest located in the kubernetes subfolder:\n\n```bash\nkubectl apply -f ./hello-krustlet/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 hello-wasi\ncargo build --release --target wasm32-wasi\n\nwasmtime run --env TARGET=/Users/bob/Downloads --dir /Users/bob/Downloads ./target/wasm32-wasi/release/hello-wasi.wasm\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Fkrustlet-at-rust-linz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthorstenhans%2Fkrustlet-at-rust-linz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorstenhans%2Fkrustlet-at-rust-linz/lists"}