AKS icon indicating copy to clipboard operation
AKS copied to clipboard

[Question] AKS kubenet: Possible Duplicate UDP packets on same-node ClusterIP traffic

Open vdidenko-dvps opened this issue 1 month ago • 11 comments

Describe scenario

Since the 15 Oct release, one in-cluster DNS query gets two UDP answers with the same query id, about 50 microseconds apart. Both answers have the same A records in a different order. The app logs "unexpected DNS response ( proxied by nginx) "

Question Has anyone else seen CoreDNS on AKS return two answers for one query id after 15 Oct?

vdidenko-dvps avatar Oct 15 '26 13:10 vdidenko-dvps

Further update

A single UDP datagram from an AKS workload to the kube-dns ClusterIP is delivered twice to a same-node CoreDNS endpoint:

first through L2 forwarding with unchanged TTL and pod MAC, then through host L3 forwarding with decremented TTL and host MAC.

The original and duplicate share the same IP ID. Remote-node CoreDNS endpoints do not exhibit the duplication....

If anyone by any chance got into this rabbit hole investigation

vdidenko-dvps avatar Oct 15 '26 13:10 vdidenko-dvps

Confirmed this is an AKS kubenet networking issue, not a CoreDNS or NGINX defect. The promiscuous cbr0 bridge delivers the same UDP packet twice when the destination pod is on the same node; cross-node traffic is unaffected.

This matches a historical Kubernetes bug (#25793) that had a packet-deduplication workaround. We suspect this protection may be missing or ineffective following a recent node reimage, but haven't confirmed the regression.

Will create support ticket to Azure

vdidenko-dvps avatar Oct 15 '26 14:10 vdidenko-dvps

@rahulrai-in are you able to assist?

sjwaight avatar Oct 17 '26 03:10 sjwaight

@sjwaight @rahulrai-in I've created a support ticket to Azure few days ago ( Support request number: 2610150050003505 ) Uploaded there some details, and packet capture traces.

vdidenko-dvps avatar Oct 19 '26 07:10 vdidenko-dvps

Case being worked with Microsoft Support, adding stale label for automatic closure if not other reports are added.

This issue will now be closed because it hasn't had any activity for 7 days after stale. @vdidenko-dvps feel free to comment again on the next 7 days to reopen or open a new issue after that time if you still have a question/issue or suggestion.

Not completed, you haven't shared that there is a confirmed Duplication and regression on Kubenet

vdidenko-dvps avatar Nov 03 '26 15:11 vdidenko-dvps

Hi @vdidenko-dvps , thank you for raising this. We've reproduced the duplicate UDP delivery and traced it to an issue in AgentBaker's kubenet node-networking setup, rather than CoreDNS itself.

Root cause

AgentBaker's packet-deduplication helper reads the legacy .ipam.subnet field, while the generated CNI configuration stores the pod CIDR under .ipam.ranges[][].subnet.

As a result, the helper receives a null value and fails to install the required iptables DROP rule, while incorrectly reporting successful setup. This leaves same-node ClusterIP traffic susceptible to duplicate packet delivery, consistent with the reported DNS symptoms.

Proposed fix

We've implemented a candidate fix in a feature branch that:

  • Reads and validates the pod CIDR from the correct configuration field, while preserving backward compatibility.
  • Restores the intended ordered ACCEPT/DROP rules without affecting unrelated rules.
  • Correctly propagates setup failures and addresses service readiness retries and boot-time enablement.

Validation

In our lab, we observed:

  • Before the fix: 1,000 requests → 2,000 backend receives.
  • After the fix: 1,000 requests → 1,000 backend receives.
  • After rollback: 1,000 requests → 2,000 backend receives.

We also reproduced the issue without the October 15 AgentBaker/image update, suggesting that the update is not required to trigger the defect. I'd suggest involving @cameronmeissner from the AgentBaker team to review the findings, validate and confirm the root cause.

christine33-creator avatar Nov 05 '26 19:11 christine33-creator

@vdidenko-dvps @christine33-creator can either of you please create an issue directly in AgentBaker: https://github.com/Azure/AgentBaker/issues and share the feature branch containing the proposed fix?

Thanks.

cameronmeissner avatar Nov 09 '26 23:11 cameronmeissner

@cameronmeissner requested access

christine33-creator avatar Nov 11 '26 21:11 christine33-creator

Case being worked with Microsoft Support, adding stale label for automatic closure if not other reports are added.