-
Notifications
You must be signed in to change notification settings - Fork 369
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 Multicast statistics #3294
Comments
Update: Networkpolicy stats for
The command In addition, numbers like The deleted command: kubectl get podmulticaststats POD INBOUND_DROPPED OUTBOUND_DROPPED IGMP_ALLOWED IGMP_DROPPED
mcjoin-k95gb 2233 0 55 22
|
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment, or this will be closed in 90 days |
Describe what you are trying to solve
This proposal is to collect and expose the statistical data of multicast. The requirements are listed below:
Per Pods stats
Networkpolicy stats for
Per multicast group stats
One
kubectl
command and oneantctl
command are introduced to display these statistics. The sample command outputs would be:The command implements the first two requirements of Per Pods stats. It is running in Antrea-agent and shows the Pod statistics of multicast traffic at node level.
The command implements the requirements 7 for Per multicast group stats.
The requirements 3,4,5,6 will be implemented with NetworkpolicyStats module in Antrea, users can get Multicast or IGMP/MLD statistics allowed/dropped by querying
kubectl get antreaclusternetworkpolicystats -o json
and find the specific statistics with ruleName of Networkpolicy that applied. Please check https://github.com/antrea-io/antrea/blob/main/docs/feature-gates.md#networkpolicystats for sample commands outputs.APIs
Internal
There is already a defined struct called
NodeStatsSummary
which contains stats produced on a Node. It's used by the Antrea-agents to report stats to the Antrea-controller. We add an extra field calledMulticast
which contains mapping of multicast group to Pods for each node. The calculation of mapping is achieved by PacketIn of IGMP report packets, which will be discussed below.The report of
Multicast
is not incremental. Antrea-controller could calculate the group Pods mapping in the whole cluster and get exposed bykubectl get multicastgroups
. For instance, in node A, Antrea-agent reports224.3.4.5
with Podsdefault/PodA, default/PodB
, and in node B, Antrea-agent reports224.2.3.4
withdefault/PodA
. Antrea-controller will update the mapping, the command givesAfter next report cycle, in node A, Antrea-agent reports
224.3.4.5
withdefault/PodA, default/PodC
, and in node B, Antrea-agent reports224.2.3.4
with empty Pods array. Antrea-controller will refresh the mapping, the command givesAlso, we defined an
antctl
endpoint withpodmulticaststats
apiPublic API
The API must follow the K8s convention so that it can be registered as an APIService and accessed by
kubectl get multicastgroups
.Antrea-controller will aggregate the stats reported in
NodeStatsSummary
by Antrea-agent and expose it tokubectl
The API group is
stats.antrea.io
, and the endpoints are/apis/stats.antrea.io/v1alpha1/podmulticaststats
and/apis/stats.antrea.io/v1alpha1/multicastgroups
.How to get these stats
Multicast
is retrieved by processing packetIn of IGMP report message. The packetIn message contains Pod info and multicast IP that wants to join.After parsing the packetIn message in antrea-agent,
func validate(event, igmpType, packetInData)
is called, which will return allowed or dropped action enforced by Networkpolicy for the Pod and specified multicast address. Then Antrea-agent will choose to continue processing the IGMP report message or drop it. Meanwhile, the statistical data of IGMP report packets that acted by Networkpolicy is calculated as well(IGMP report of requirement 5 and 6).For non-IGMP multicast traffic statistics acted by Networkpolicy, the data comes from flows that are created by Antrea-agents, and will be process by Networkpolicystats pipeline that has already created by Antrea. See #3660 and #3323. Flow examples:
The data that feeds
antctl get podmulticaststats
api is from the flows that update when Pod created or deleted. When pod is added by cluster, one flow entry will be created on MulticastEgressPodMetric and MulticastIngressPodMetric, respectively, with their IP(nw_src) and port(reg1) to match inbound multicast and outbound multicast statistics for this Pod.Everytime users try to query
antctl get podmulticaststats
, the flows will be parsed and displayed as an example described above.Prometheus Integration
Not plan to integrate it as discussed in Support NetworkPolicy statistics(#985)
Additional context
PRs for this feature:
The text was updated successfully, but these errors were encountered: