containerd/runwasi

Can not run a pod in a Kubernetes cluster with wasmedge-shim

miraclejzd opened this issue · 3 comments

My Kubernetes version: v1.22.1

I install the containerd-wasmedge-shim/v0.3.0 from the release page and I cp them to /usr/local/bin.

This is my /etc/containerd/config.toml:

        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmedge]
          runtime_type = "io.containerd.wasmedge.v1"

I can run a wasm application directly using containerd:

root@master-153:~/projects# ctr run --rm --runtime io.containerd.wasmedge.v1  --platform=wasi/wasm  docker.io/wasmedge/example-wasi:latest wasm-example
Random number: 1730858542
Random bytes: [33, 62, 23, 84, 147, 22, 145, 117, 20, 27, 180, 1, 152, 25, 212, 224, 12, 11, 130, 167, 203, 124, 76, 238, 176, 210, 155, 192, 187, 215, 24, 251, 170, 203, 107, 136, 207, 54, 29, 11, 45, 36, 13, 182, 107, 90, 197, 145, 110, 213, 35, 16, 156, 61, 158, 29, 240, 71, 61, 211, 232, 115, 90, 205, 40, 134, 24, 21, 64, 250, 189, 215, 26, 38, 115, 131, 199, 46, 60, 237, 101, 183, 202, 154, 9, 175, 58, 193, 79, 110, 61, 20, 192, 178, 230, 76, 48, 8, 105, 89, 170, 174, 150, 231, 72, 34, 194, 234, 8, 124, 238, 211, 46, 204, 20, 43, 150, 121, 244, 44, 142, 105, 223, 133, 115, 159, 157, 146]
Printed from wasi: This is from a main function
This is from a main function
The env vars are as follows.
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
The args are as follows.
/wasi_example_main.wasm
File content is This is in a file

But when I try to run a pod in k8s, it does not work.

I have applied a RuntimeClass resource like this:

apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: wasmedge
handler: wasmedge

And this is my pod's yaml:

apiVersion: v1
kind: Pod
metadata:
  name: wasi-example-pod
spec:
  containers:
  - name: example-container
    image: docker.io/wasmedge/example-wasi:latest
  restartPolicy: Never
  runtimeClassName: wasmedge

But the kubectl describe shows that:

  Normal   Scheduled               7s    default-scheduler  Successfully assigned default/wasi-example-pod to master-153
  Warning  FailedCreatePodSandBox  7s    kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = RuntimeHandler "wasmedge" not supported

I really want to know why... If someone need more information, please do not hesitate to comment.

Have you checked if your k8s cluster has the shim binary in the /usr/local/bin?

RuntimeHandler "wasmedge" not supported is telling me that containerd cannot find the wasmedge shim binary in PATH.

Have you checked if your k8s cluster has the shim binary in the /usr/local/bin?

RuntimeHandler "wasmedge" not supported is telling me that containerd cannot find the wasmedge shim binary in PATH.

Thx for replying.
I am very sure that the shim binary is in PATH.

However, I reset my k8s cluster's version from 1.22.1 to 1.28.1, it works. I don't why this could happen, but I am so happy to see it works :)

Happy to see the issue was resolved! Closing it