Install knative and WASMEdge on IBM Cloud

  1. Create a cluster called knawd-k8s on IBM Cloud. For full instructions see https://cloud.ibm.com/docs/containers?topic=containers-getting-started

  2. Install the IBM Cloud Cli. The instructions please ensure you install the https://cloud.ibm.com/docs/cli?topic=cli-getting-started

  3. Install the kubernetes service plugin https://cloud.ibm.com/docs/cli?topic=cli-install-devtools-manually#idt-install-kube

  4. Once the cluster is complete login with the ibmcloud cli

    ibm cloud login
    
  5. Now configure the kubectl connection

    ibmcloud ks cluster config -c knawd-k8s
    
  6. We are going to follow a summary of the instructions for the knative website.

  7. Install the custom resource definitions which are the objects such as service that you will use to deploy an app.

    kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.8.3/serving-crds.yaml
    
  8. Then install the knative serving core

    kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.8.3/serving-core.yaml
    
  9. Now we install the networking layer

    kubectl apply -f https://github.com/knative/net-kourier/releases/download/knative-v1.8.1/kourier.yaml
    
  10. And Patch the knative space

    kubectl patch configmap/config-network \
     --namespace knative-serving \
     --type merge \
     --patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
    
  11. Finally configure dns

    kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.8.3/serving-default-domain.yaml
    
  12. Patch the knative service to allow for the crun runtime to be specified as an attribute in the service.

    kubectl patch configmap/config-features -n knative-serving --type merge --patch '{"data":{"kubernetes.podspec-runtimeclassname":"enabled"}}'
    
  13. Now run install the deployment project

    git clone https://github.com/uirlis/wasi-crun-deployer
    cd wasi-crun-deployer/charts/wasi-crun-deployer
    helm install wasi-crun-deployer . --create-namespace --namespace knawd --set job.autoRestart=true
    
  14. Finally run the tempate helloworld service.

    git clone https://github.com/uirlis/helloworld-rust-wasi
    cd helloworld-rust-wasi
    kubectl apply -f service.yaml
    
  15. Get the external IP of the kourier network

    kubectl get svc kourier -n kourier-system
    
    NAME      TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
    kourier   LoadBalancer   172.21.191.127   159.122.80.147   80:32294/TCP,443:31406/TCP   44m
    
    
  16. Visit the endpoint generated buy sslip.io - http://helloworld-rust-wasi.default..sslip.io/

    curl http://helloworld-rust-wasi.default.159.122.80.147.sslip.io/
    Hello Rust Sample v1