...

/

Deploy and Test the App

Deploy and Test the App

Learn how we can deploy and test a WebAssembly app on Kubernetes.

We'll cover the following...

The app is defined in the app.yml file in the wasm folder of the course’s GitHub repo and comprises a Deployment, a Service, and an Ingress.

https://github.com/Educative-Content/TheK8sBook/tree/main/wasm/app.yml

Configuring the resources

The important part of the Deployment YAML is the reference to the RuntimeClass in the Pod spec. This will ensure all three replicas get scheduled to a node that meets the nodeSelector requirements in the RuntimeClass (nodes with the wasm=yes label). All three replicas will be scheduled to the agent-1 node in our example.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: wasm-spin
spec:
  replicas: 3
  selector:
    matchLabels:
      app: wasm
  template:
    metadata:
      labels:
        app: wasm
    spec:
      runtimeClassName: rc-spin
      containers:
        - name: testwasm
          image: nigelpoulton/k8sbook:wasm-0.1
          command: ["/"]
---
apiVersion: v1
kind: Service
metadata:
  name: svc-wasm
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  selector:
    app: wasm
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ing-wasm
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
spec:
  ingressClassName: traefik
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: svc-wasm
                port:
                  number: 80
Playground

There’s also an Ingress and a Service present in the ...

Access this course and 1400+ top-rated courses and projects.