- Ubuntu 20.04 (Focal) or later
- A host machine with at least:
- 4-core CPU processor
- 32GB RAM
- 50GB of disk space available
KCD Bengaluru Docker + WASM workloads running side by side
You’ll complete the following steps:
- Build a K3d cluster
- Verify the runtime configuration
- Configure node labels
- Create a RuntimeClass
- Deploy an app
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
# --image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.5.1: This flag specifies the Docker image to use as the base image for the cluster nodes. In this case, the image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.5.1 is being used. This image contains the necessary components for running WebAssembly workloads using containerd and k3d. | |
# --agents 2: This flag specifies the number of worker nodes or agents to create in the cluster. In this case, it creates two agents to distribute the workload across multiple nodes. | |
``` | |
k3d cluster create wasm-cluster1 \ | |
--image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.5.1 \ | |
-p "8081:80@loadbalancer" --agents 2 | |
``` |
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
Gender | Age | Salary | Purchase Iphone | |
---|---|---|---|---|
Male | 19 | 19000 | 0 | |
Male | 35 | 20000 | 0 | |
Female | 26 | 43000 | 0 | |
Female | 27 | 57000 | 0 | |
Male | 19 | 76000 | 0 | |
Male | 27 | 58000 | 0 | |
Female | 27 | 84000 | 0 | |
Female | 32 | 150000 | 1 | |
Male | 25 | 33000 | 0 |
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: wasmedge
handler: wasmedge
---
apiVersion: batch/v1
kind: Job
metadata:
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
const {babel} = require('@rollup/plugin-babel'); | |
const nodeResolve = require('@rollup/plugin-node-resolve'); | |
const commonjs = require('@rollup/plugin-commonjs'); | |
const replace = require('@rollup/plugin-replace'); | |
const globals = require('rollup-plugin-node-globals'); | |
const builtins = require('rollup-plugin-node-builtins'); | |
const plugin_async = require('rollup-plugin-async'); | |
const css = require("rollup-plugin-import-css"); | |
const svg = require('rollup-plugin-svg'); |
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
import * as React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import * as std from 'std'; | |
import * as http from 'wasi_http'; | |
import * as net from 'wasi_net'; | |
import App from '../src/App.js'; | |
async function handle_client(cs) { | |
print('open:', cs.peer()); | |
let buffer = new http.Buffer(); | |
while (true) { |