某些机器上无法从 pod 到达 pod,但可以到达节点中的隧道

某些机器上无法从 pod 到达 pod,但可以到达节点中的隧道

我在裸机 Kubernetes 1.19 集群中有一个集群 IP 为 10.233.70.35 的 pod,该集群使用 Calico 3.16.9 作为 CNI。我们将其称为Pod A。在大多数节点(与 的节点不同Pod A)中,同一 Kubernetes 命名空间中的 pod(Pod B)可以到达,如以下Pod A节点上的 pcap 所示:Pod A

# tcpdump -vv -i calib33bd7211a6|grep 10.233.109.62
tcpdump: listening on calib33bd7211a6, link-type EN10MB (Ethernet), capture size 262144 bytes
    10.233.109.62.60372 > 10.233.70.35.tproxy: Flags [S], cksum 0x16af (correct), seq 2138999970, win 64240, options [mss 1460,sackOK,TS val 2089146656 ecr 0,nop,wscale 7], length 0
    10.233.70.35.tproxy > 10.233.109.62.60372: Flags [S.], cksum 0xc961 (incorrect -> 0x579e), seq 3985188010, ack 2138999971, win 65160, options [mss 1460,sackOK,TS val 4061902615 ecr 2089146656,nop,wscale 7], length 0
    10.233.109.62.60372 > 10.233.70.35.tproxy: Flags [.], cksum 0x82fd (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 2089146656 ecr 4061902615], length 0
# tcpdump -vv -i tunl0|grep 10.233.109.62
tcpdump: listening on tunl0, link-type RAW (Raw IP), capture size 262144 bytes
    10.233.109.62.34294 > 10.233.70.35.tproxy: Flags [S], cksum 0xbd5b (correct), seq 1964000002, win 64240, options [mss 1460,sackOK,TS val 1018637359 ecr 0,nop,wscale 7], length 0
    10.233.70.35.tproxy > 10.233.109.62.34294: Flags [S.], cksum 0xc961 (incorrect -> 0x7b0b), seq 1667300057, ack 1964000003, win 65160, options [mss 1460,sackOK,TS val 4061982287 ecr 1018637359,nop,wscale 7], length 0
    10.233.109.62.34294 > 10.233.70.35.tproxy: Flags [.], cksum 0xa66a (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 1018637359 ecr 4061982287], length 0
    10.233.109.62.34294 > 10.233.70.35.tproxy: Flags [F.], cksum 0x592f (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 1018657129 ecr 4061982287], length 0
    10.233.70.35.tproxy > 10.233.109.62.34294: Flags [F.], cksum 0xc959 (incorrect -> 0x0bec), seq 1, ack 2, win 510, options [nop,nop,TS val 4062002057 ecr 1018657129], length 0
    10.233.109.62.34294 > 10.233.70.35.tproxy: Flags [.], cksum 0x0bf3 (correct), seq 2, ack 2, win 502, options [nop,nop,TS val 1018657130 ecr 4062002057], length 0

然而,在某些机器上(再次不同于 的节点),同一个 k8s 命名空间中的Pod Apod( )虽然能够到达的节点的隧道,但却无法到达,如下所示:Pod CPod APod A

# tcpdump -vv -i calib33bd7211a6|grep 10.233.82.51
tcpdump: listening on calib33bd7211a6, link-type EN10MB (Ethernet), capture size 262144 bytes
# tcpdump -vv -i tunl0|grep 10.233.82.51
tcpdump: listening on tunl0, link-type RAW (Raw IP), capture size 262144 bytes
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0xc924 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899329055 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0xc529 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899330074 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0xbd49 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899332090 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0xacc9 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899336314 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0x8cc9 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899344506 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0x4dc9 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899360634 ecr 0,nop,wscale 7], length 0
    10.233.82.51.35038 > 10.233.70.35.tproxy: Flags [S], cksum 0xc9c8 (correct), seq 2532090843, win 64240, options [mss 1460,sackOK,TS val 3899394426 ecr 0,nop,wscale 7], length 0

我该怎么做才能修复此问题,以便Pod A任何节点上的任何 pod 都可以访问它?

所有节点都位于同一子网中,但分布在两个 L2 交换机上。此问题似乎发生在其中一个交换机中的某些节点上,但是由于Pod A的机器已通过隧道到达,因此此观察结果无关紧要。

相关内容