Skip to content

DNS latency of 5s when uses iptables forward in pods network traffic #62628

@xiaoxubeii

Description

@xiaoxubeii

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened:
The DNS will get a 5s latency of AAAA when uses iptables forward in network traffic between pods.

What you expected to happen:
No latency.

How to reproduce it (as minimally and precisely as possible):

  • CNI configuration
        "name": "mynet",
        "type": "macvlan",
	"master": "eth0",
        "ipam": {
                "type": "host-local",
                "subnet": "172.20.0.0/17",
		"rangeStart": "172.20.64.129",
		"rangeEnd": "172.20.64.254",
		"gateway": "172.20.127.254",
		"routes": [
			{"dst":"0.0.0.0/0"},
			{"dst":"172.20.80.0/24", "gw":"172.20.0.62"}
		]
        }
}
  • Network Architecture
    The cluster cidr is 172.20.80.0/24, gw is current node. Cluster, pods and nodes are in l2 network using VXLAN.

Anything else we need to know?:
If cni gw of cluster cidr is current node, the network traffic between pods and services will use iptables forward:

-P FORWARD ACCEPT
-A FORWARD -m comment --comment "kubernetes forward rules" -j KUBE-FORWARD

-N KUBE-FORWARD
-A KUBE-FORWARD -m comment --comment "kubernetes forwarding rules" -m mark --mark 0x4000/0x4000 -j ACCEPT
-A KUBE-FORWARD -s 172.20.0.0/17 -m comment --comment "kubernetes forwarding conntrack pod source rule" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A KUBE-FORWARD -d 172.20.0.0/17 -m comment --comment "kubernetes forwarding conntrack pod destination rule" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

If enable forwarding conntrack, netfilter will drop first AAAA record packet when requests dns. It will cause dns latency of 5s.

Environment:

  • Kubernetes version (use kubectl version): v1.9.2
  • Cloud provider or hardware configuration: None
  • OS (e.g. from /etc/os-release): CentOS Linux release 7.2.1511 (Core)
  • Kernel (e.g. uname -a): 3.10.0-327.18.2.el7.x86_64
  • Install tools: kubeadm
  • Others:

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.sig/networkCategorizes an issue or PR as relevant to SIG Network.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions