Diagnose mesh traffic with a packet inspection task
Service Mesh (ASM) lets you run packet inspection tasks on workloads in your mesh. These tasks capture TCP traffic from a pod for a specified period and save the data to a host node in the Kubernetes cluster for download and analysis. This topic describes how to use a packet inspection task to diagnose mesh traffic.
Background
When you add applications to a service mesh, you might encounter unexpected traffic behavior. For example, a request header can be too large, or a request might not follow the standard HTTP protocol. Packet inspection tasks capture traffic information from a workload, which helps you quickly diagnose these complex issues.
Prerequisites
-
You have created an ASM Enterprise Edition or Ultimate Edition instance that runs version 1.21.6.72 or later. For more information, see Create an ASM instance or Upgrade an ASM instance.
-
You have added a cluster to the ASM instance.
Procedure
-
Log on to the ASM console. In the left-side navigation pane, choose .
-
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
-
On the Mesh Diagnosis page, click Service Packet Inspection.
-
On the Service Packet Inspection page, click Create Task. In the dialog box that appears, specify the Kubernetes Clusters, Namespace, and Pod Name of the pod to inspect. Then, configure the Duration, tcpdump Parameters (see the tcpdump man page for details), and Save File Name. Click OK.
-
On the Service Packet Inspection page, wait until the task Status changes to Complete.
-
Based on the Host Node and File Path information for the task, locate the corresponding Kubernetes host node and download the pcap file from the specified path. For instructions on how to download files, see Use Workbench to upload or download files.
Related operations
Delete a packet inspection task
-
Log on to the ASM console. In the left-side navigation pane, choose .
-
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
-
On the Mesh Diagnosis page, click Service Packet Inspection.
-
On the Service Packet Inspection page, find the task that you want to delete and click Delete in the Actions column. In the confirmation dialog box, click OK.
Common tcpdump parameters
This section provides common tcpdump parameters for inspecting different types of traffic.
-
To inspect traffic between the sidecar and the application in a client pod, use the following parameters.
# Replace 172.16.xx.xx with the Service IP of the destination service. -i lo dst port 15001 or src host 172.16.xx.xx -
To inspect traffic between the sidecar and the destination service in a client pod, use the following parameters.
# Replace 192.168.xx.xx with the pod IP of the destination service. -i any host 192.168.xx.xx -
To inspect traffic between the sidecar and the application in a server pod, use the following parameters.
-i lo host 127.0.0.6 -
To inspect traffic between the sidecar in a server pod and a client pod, use the following parameters.
# Replace 192.168.xx.xx with the client pod IP. -i any host 192.168.xx.xx