Using Kubernetes
Find the video guide for below instructions over here.
In this guide, we will be using Goreplay to mirror the traffic to HyperTest. Goreplay will be added as a sidecar container in your deployment.
Update your application's deployment as per the below example
You can add Goreplay as a sidecar by either directly editing your application deployment file or by using kubectl patch commands to patch the deployment.
Please note that if you use kubectl patch method, the changes will be lost when the deployment gets deleted. You will have to patch the deployment again
Required Parameters to run Goreplay:
APPLICATION_PORT: <port on which your app is running>
HYPERTEST_LOGGER_URL: <hypertest-vm-ip>:<hypertest-logger-port> or <hypertest_service_logger_ingress_url>
HT_ENV: <your env name> # for eg: test, staging, etc
Edit the application's deployment file
Edit the application's deployment file and add Goreplay as sidecar container.
Only copy the parts from ## copy from this till ## to this. Rest is just sample manifest file
For below example, we have a node-app deployment where we are adding a Goreplay sidecar container.
Apply the manifest file using below command
Check if the pod is up and running with 2 containers ( 1 additional goreplay) using below command (give appropriate namespace)
Now traffic coming to this app is being mirrored to HyperTest.
To Verify the mirroring setup, hit any api on the application and check for request in "last mirrored requests" section or Session page in HyperTest.
Debug mirroring setup via Goreplay
To debug if goreplay is receiving the traffic from your application, we will output the incoming traffic to stdout, so we can see if Goreplay is receiving requests.
Steps:
Exec into the goreplay container using below command:
2. Run the following command:
Now hit any api on your application and verify if Goreplay is able to receive it.
ALTERNATE WAY
Another way to add Goreplay is to directly patch the deployment. If you have edited your deployment using above method, you don't need to do this.
Patch an existing deployment via kubectl
Create a file with below content
Apply the patch changes to your deployment using below command:
Check if the pod is up and running with 2 containers using below command (give appropriate namespace)
Now traffic coming to this application is being mirrored to HyperTest.
To verify the mirroring setup, hit any api on the application and check for request in "last mirrored requests" section or Session page in HyperTest.
Last updated