Istio Recording

When you have deployed applications in an Istio service mesh in a Kubernetes cluster and you want to record the communications between the services, you can use HCL OneTest API to record the HTTP traffic in Istio.

Prerequisites to using the Istio service mesh

You must have completed the following tasks:
  • Setting up the Istio control plane on Kubernetes in your IT infrastructure. For more information, refer to the Istio Documentation.
  • Installed Istio V1.4 or later.
  • Installed the kubeconfig file on the computer where you have installed HCL OneTest API to enable successful communications between HCL OneTest API and the Kubernetes cluster. HCL OneTest API searches for the kubeconfig file called config in the $HOME/.kube directory, the default location. If the location of the kubeconfig is different from the default location, then you must specify the path to the config file in the environment variable KUBECONFIG. For more information about using kubeconfig files, refer to Organizing Cluster Access Using kubeconfig Files.

Recording HTTP traffic

You can record the following types of requests received or sent by the Istio service mesh:
  • Requests received by services in the Istio service mesh.
  • Requests sent from namespaces in the Istio service mesh to external services that are not in the Istio service mesh.

Task flow for recording the HTTP traffic in Istio

The task flow helps you to use the information in the topics for completing the task to record the HTTP traffic in Istio..
Task More information

1

Set up Istio. Istio Documentation

2

Create an HTTP transport. Creating HTTP transports

3

Create a logical HTTP connection. Creating logical HTTP connections

4

Create a physical Web Server resource for an HTTP transport. Creating physical web server resources

4.1

Provide the name of the service that is receiving the traffic to record, in the Host field and the service port number in the Port field in the Settings tab in the Web Server dialog box. Step 3

4.2

Provide the namespace for the service to record in the Kubernetes cluster in the Kubernetes namespace field in the Recording tab in the Web Server dialog box.
Note: As the Web Server configured in the settings tab is a service within the Kubernetes cluster, the Test Transport action does not complete the test because the host and port configured are not reachable to HCL OneTest API.
Step 8
5
Configure the Recording Port and Recording Bind Address in the Application page of the Library Manager.
Notes:
  • The Recording Port and Recording Bind Address must be configured to prevent HCL OneTest API to bind to a network address that is not accessible within the Kubernetes cluster or when there are multiple network interfaces.
  • If HCL OneTest API is running, you must restart it to ensure that any changes that you made to the Library Manager can take effect.
Working with Library Manager

6

In the Recording Studio, create an event monitor to monitor the transport or operation (that uses the transport), and then start the recording.
Notes:
  • The monitor records traffic only for the host that is specified in the web server transport settings, which is the default behavior when the Host Filter is set to On in the Event Monitor Properties panel. If the Host Filter is set to Off, the monitor records the HTTP traffic that is received by all services in the defined namespace and on the service port configured, in the Kubernetes cluster.
  • When the Host Filter is set to Off, a HTTP header named X-Via-Filter is added to the recorded requests. If required, you can change the name by using the Java system property Dcom.ghc.istio.recording.lua.viafilterheader=<header-name>.
  • When the recording is started, HCL OneTest API creates Istio EnvoyFilter resources to monitor the HTTP messages. These resources are removed when recording is stopped. If HCL OneTest API has not removed the resources, you can remove the resources manually with the command: kubectl delete -n <namespace> envoyfilters -l onetest=recorder.
Recording HTTP and HTTPS traffic

Result

You are recording HTTP messages sent by the namespace in the Istio service mesh or received by Istio enabled services on the configured port in a Kubernetes cluster.

What to do next

You can create stubs from the recorded events by using the Recording Studio. See Stub creation by using the Recording Studio.