SuperEdge

Install Superedge

One-click install of edge Kubernetes cluster

  • Download the installation package

Choose installation package according to your installation node CPU architecture [amd64, arm64]

  1. arch=amd64 version=v0.6.0 && rm -rf edgeadm-linux-* && wget https://superedge-1253687700.cos.ap-guangzhou.myqcloud.com/$version/$arch/edgeadm-linux-containerd-$arch-$version.tgz && tar -xzvf edgeadm-linux-* && cd edgeadm-linux-$arch-$version && ./edgeadm
  • Install edge Kubernetes master node with containerd runtime
  1. ./edgeadm init --kubernetes-version=1.18.2 --image-repository superedge.tencentcloudcr.com/superedge --service-cidr=10.96.0.0/12 --pod-network-cidr=192.168.0.0/16 --install-pkg-path ./kube-linux-*.tar.gz --apiserver-cert-extra-sans=<Master Public IP> --apiserver-advertise-address=<Master Intranet IP> --enable-edge=true --runtime=containerd
  • Join edge node with containerd runtime
  1. ./edgeadm join <Master Public/Intranet IP Or Domain>:Port --token xxxx --discovery-token-ca-cert-hash sha256:xxxxxxxxxx --install-pkg-path <edgeadm kube-* install package address path> --enable-edge=true --runtime=containerd

See the detailed processOne-click install of edge Kubernetes cluster

Other installation, deployment, and administration, see our Tutorial.

Install WasmEdge

Use the simple install script to install WasmEdge on your edge node.

  1. curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash

Build And install Crun with WasmEdge

The crun project has WasmEdge support baked in. For now, the easiest approach is just to build it yourself from source. First, let’s make sure that crun dependencies are installed on your Ubuntu 20.04. For other Linux distributions, please see here.

  1. sudo apt update
  2. sudo apt install -y make git gcc build-essential pkgconf libtool \
  3. libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev \
  4. go-md2man libtool autoconf python3 automake

Next, configure, build, and install a crun binary with WasmEdge support.

  1. git clone https://github.com/containers/crun
  2. cd crun
  3. ./autogen.sh
  4. ./configure --with-wasmedge
  5. make
  6. sudo make install

Reconfigure containerd with crun runtime

Superedge containerd node has default config, we should modify the configuration file(/etc/containerd/config.toml) according to the following steps.

Firstly, we generate config.toml.diff diff file and patch it.

  1. cat > config.toml.diff << EOF
  2. --- /etc/containerd/config.toml 2022-02-14 15:05:40.061562127 +0800
  3. +++ /etc/containerd/config.toml.crun 2022-02-14 15:03:35.846052853 +0800
  4. @@ -24,17 +24,23 @@
  5. max_concurrent_downloads = 10
  6. [plugins.cri.containerd]
  7. - default_runtime_name = "runc"
  8. - [plugins.cri.containerd.runtimes.runc]
  9. + default_runtime_name = "crun"
  10. + [plugins.cri.containerd.runtimes.crun]
  11. runtime_type = "io.containerd.runc.v2"
  12. - pod_annotations = []
  13. + pod_annotations = ["*.wasm.*", "wasm.*", "module.wasm.image/*", "*.module.wasm.image", "module.wasm.image/variant.*"]
  14. container_annotations = []
  15. privileged_without_host_devices = false
  16. - [plugins.cri.containerd.runtimes.runc.options]
  17. - BinaryName = "runc"
  18. + [plugins.cri.containerd.runtimes.crun.options]
  19. + BinaryName = "crun"
  20. # cni
  21. [plugins.cri.cni]
  22. bin_dir = "/opt/cni/bin"
  23. conf_dir = "/etc/cni/net.d"
  24. conf_template = ""
  25. + [plugins."io.containerd.runtime.v1.linux"]
  26. + no_shim = false
  27. + runtime = "crun"
  28. + runtime_root = ""
  29. + shim = "containerd-shim"
  30. + shim_debug = false
  31. EOF
  1. sudo patch -d/ -p0 < config.toml.diff
  2. sudo systemctl restart containerd

Create Wasmedge application in Superedge

We can run a wasm image which has been pushed to dockerhub. If you want to learn how to compile, package, and publish the WebAssembly program as a container image to Docker hub, please refer to WasmEdge Book.

  1. cat > wasmedge-app.yaml << EOF
  2. apiVersion: v1
  3. kind: Pod
  4. metadata:
  5. annotations:
  6. module.wasm.image/variant: compat
  7. labels:
  8. run: wasi-demo
  9. name: wasi-demo
  10. spec:
  11. containers:
  12. - args:
  13. - /wasi_example_main.wasm
  14. - "50000000"
  15. image: hydai/wasm-wasi-example:with-wasm-annotation
  16. imagePullPolicy: IfNotPresent
  17. name: wasi-demo
  18. hostNetwork: true
  19. restartPolicy: Never
  20. EOF
  21. kubectl create -f wasmedge-app.yaml

The output will show by executing kubectl logs wasi-demo command.

  1. Random number: -1643170076
  2. Random bytes: [15, 223, 242, 238, 69, 114, 217, 106, 80, 214, 44, 225, 20, 182, 2, 189, 226, 184, 97, 40, 154, 6, 56, 202, 45, 89, 184, 80, 5, 89, 73, 222, 143, 132, 17, 79, 145, 64, 33, 17, 250, 102, 91, 94, 26, 200, 28, 161, 46, 93, 123, 36, 100, 167, 43, 159, 82, 112, 255, 165, 37, 232, 17, 139, 97, 14, 28, 169, 225, 156, 147, 22, 174, 148, 209, 57, 82, 213, 19, 215, 11, 18, 32, 217, 188, 142, 54, 127, 237, 237, 230, 137, 86, 162, 185, 66, 88, 95, 226, 53, 174, 76, 226, 25, 151, 186, 156, 16, 62, 63, 230, 148, 133, 102, 33, 138, 20, 83, 31, 60, 246, 90, 167, 189, 103, 238, 106, 51]
  3. Printed from wasi: This is from a main function
  4. This is from a main function
  5. The env vars are as follows.
  6. The args are as follows.
  7. /wasi_example_main.wasm
  8. 50000000
  9. File content is This is in a file