Service Meshes Available

istio

WebAssembly and intelligent data planes

In this lab, you will use the sample application Image Hub. This version of the Image Hub filter has been simplified for your lab. To self-study deeper functionality, try the other version of the Image Hub filter that is available in the Image Hub repo.

Deploy Sample Application

Using Meshery, select Istio from the Management menu.

In the Istio management page:

  1. Type default into the namespace field.
  2. Click the (+) icon on the Manage Sample Application Lifecycle card and select Image Hub Application to install the latest version of Image Hub


Load the filter

Next, load the custom Envoy filter. This filter is written in Rust and is compiled against WebAssembly as it's target runtime.

Using Meshery, select Istio from the Management menu.

In the Istio management page:

  1. Type default into the namespace field.
  2. Click the (+) icon on the Apply Service Mesh Configuration card and select Envoy Filter for Image Hub to deploy the custom filter.


Send traffic


Analyze behavior

Alternative, manual installation steps are provided for reference below. No need to execute these if you have performed the steps above.

Manually deploy the Image Hub filter.

1apiVersion: networking.istio.io/v1alpha3
2kind: EnvoyFilter
3metadata:
4 name: custom-filter
5spec:
6 configPatches:
7 - applyTo: HTTP_FILTER
8 match:
9 context: SIDECAR_OUTBOUND # will match outbound listeners in all sidecars
10 listener:
11 portNumber: 9080
12 filterChain:
13 name: envoy.http_connection_manager
14 filter:
15 name: "envoy.tcp_proxy"
16 patch:
17 operation: INSERT_BEFORE
18 value:
19 # This is the full filter config including the name and config or typed_config section.
20 name: "envoy.filters.http.wasm"
21 config:
22 config:
23 name: custom-filter
24 rootId: my_root_id
25 vmConfig:
26 code:
27 local:
28 filename: /var/lib/imagehub/filter.wasm
29 runtime: envoy.wasm.runtime.v8
30 vmId: custom-filter
31 allow_precompiled: true
32 workloadSelector:
33 labels:
34 app: api-v1
35 version: v1

Manually patch the Image Hub Deployment.

1---(
2 // kubectl patch deployment/api-v1 -p '
3 {
4 "spec": {
5 "template": {
6 "metadata": {
7 "annotations": {
8 "sidecar.istio.io/userVolumeMount": "[{\"mountPath\":\"/var/lib/imagehub\",\"name\":\"wasm-filter\"}]"
9 }
10 },
11 "spec": {
12 "initContainers": [
13 {
14 "command": [
15 "curl",
16 "-L",
17 "-o",
18 "/var/lib/imagehub/filter.wasm",
19 "https://github.com/layer5io/advanced-istio-service-mesh-workshop/raw/master/lab-7/ratelimiter/ratelimit-filter.wasm"
20 ],
21 "image": "curlimages/curl",
22 "imagePullPolicy": "Always",
23 "name": "add-wasm",
24 "resources": {},
25 "terminationMessagePath": "/dev/termination-log",
26 "terminationMessagePolicy": "File",
27 "volumeMounts": [
28 {
29 "mountPath": "/var/lib/imagehub",
30 "name": "wasm-filter"
31 }
32 ]
33 }
34 ],
35 "volumes": [
36 {
37 "emptyDir": {},
38 "name": "wasm-filter"
39 }
40 ]
41 }
42 }
43 }
44 }
45)
46// '

A future version of Meshery will allow you to deploy any filter from the wasm-filters repo. PR the repo to upload your custom filter and have Meshery deploy it.

NEXT CHAPTER

Getting Started

Layer5, the cloud native management company

An empowerer of engineers, Layer5 helps you extract more value from your infrastructure. Creator and maintainer of cloud native standards. Maker of Meshery, the cloud native manager.