Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tracing live traffic in Traceflow #2030

Closed
jianjuns opened this issue Apr 5, 2021 · 7 comments
Closed

Support tracing live traffic in Traceflow #2030

jianjuns opened this issue Apr 5, 2021 · 7 comments
Assignees
Labels
area/ops/traceflow Issues or PRs related to the Traceflow feature kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@jianjuns
Copy link
Contributor

jianjuns commented Apr 5, 2021

Describe what you are trying to solve
Support tracing real traffic going on between Pods, besides tracing the injected Traceflow packet.
Collect the captured packet headers for live-traffic tracing.
Support tracing only the packets dropped by NetworkPolicies.

Examples:

  • I like to trace the TCP packet from Pod1 to Service1.
  • I like to trace the first UDP packet from Pod1 in 10 minutes, and check the source/destination ports and packet length.
  • I like to capture the first packet dropped by NetworkPolicies from Pod1 within 1 hour.

Describe the solution you have in mind
Add a flag - LiveTraffic - in Traceflow.Spec to indicate live-traffic tracing. When it is set, instead of generating and injecting a Traceflow packet, the sender Node should just add flows to tag the first packet of the first connection from the Source Pod that matches the Traceflow spec. The tag should be removed before the packet leaving the Antrea pipeline (e.g. outputing to the destination Pod, or sending to external).

Addd a new field to Traceflow.Status for collecting the (IP/TCP/UDP) header information of the captured packet. Antrea Agent on the Sender Node should report the captured packet headers to Traceflow.Status.CapturePacket.

Add a flag - DroppedOnly - Traceflow.Spec to indicate only the dropped packet should be traced/captured. Antrea Agent should add flows to capture only the packets dropped by NetworkPolicies (and match the Traceflow spec).

Add a Timeout attribute to Traceflow.Spec to specify the timeout time of a Traceflow session.

Extend antctl and Octant UI to support live-traffic Traceflow.

Example antctl command

# Capture the first dropped TCP packet from Pod client to Service web-server within 10m.
$ antctl traceflow -S client -D web-server --live-traffic -f tcp -t 10m --dropped-only
name: client-web-server-to-any-5sb65mnq
phase: Succeeded
source: client
destination: web-server
results:
- node: k8s2
  timestamp: 1617591772
  observations:
  - component: Forwarding
    componentInfo: Classification
    action: Received
  - component: NetworkPolicy
    componentInfo: IngressDefaultRule
    action: Dropped
capturedPacket:
  srcIP: 172.100.0.16
  dstIP: 172.100.1.13
  length: 60
  ipHeader:
    protocol: 6
    ttl: 62
    flags: 2
  tranportHeader:
    tcp:
      srcport: 47950
      dstport: 80
      flags: 2
@jianjuns jianjuns added kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. area/ops/traceflow Issues or PRs related to the Traceflow feature labels Apr 5, 2021
@jianjuns jianjuns self-assigned this Apr 5, 2021
@jianjuns
Copy link
Contributor Author

jianjuns commented Apr 5, 2021

@srikartati
Copy link
Member

srikartati commented Apr 8, 2021

Addd a new field to Traceflow.Status for collecting the (IP/TCP/UDP) header information of the captured packet. Antrea Agent on the Sender Node should report the captured packet headers to Traceflow.Status.CapturePacket.

Hi @jianjuns , Interesting feature with traceflow. Is it possible to capture this packet on the receiver node as well? I think this can be useful to figure out if the packet of a flow reached the destination or dropped somewhere in the underlay.

@jianjuns
Copy link
Contributor Author

Yes, it does trace the forwarding path from sender to receiver just like a normal Traceflow, but I meant only the sender will report the packet header info.

@srikartati
Copy link
Member

Thanks Jianjun. What I meant is could the antrea agent on the receiver node also report these packet headers with a different traceflow request?
If I am not wrong, you seem to be adding that functionality in this PR: #2068

@jianjuns
Copy link
Contributor Author

So of now a sender/source Pod must be specified for a Traceflow, and then I feel it is good enough for only the sender to report packet headers (but the receiver will report NodeResult too which proves the packet is received on the receiver Node and is delivered to the destination Pod or dropped).
#2068 is to support capture a packet from any sender to a receiver, in which case only the receiver will report the packet.
Do the above answer your question?

@srikartati
Copy link
Member

Got it. Thanks for clarifying, Jianjun.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ops/traceflow Issues or PRs related to the Traceflow feature kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants