Calico从所有节点播发所有Kubernetes节点子网

时间:2019-06-27 17:24:23

标签: kubernetes bgp project-calico

Diagram of Nodes

我正在运行Calico Node2Node Mesh。并成功设置与我的上游交换机的对等连接。

看起来很奇怪,似乎每个节点都在通告所有节点网络。我认为每个节点都应公布其/ 26范围和服务范围。相反,它将发布所有4/26(特定于节点的子网)和服务范围。我担心这会遇到一些多路径问题。

这是预期的行为吗?

172.16。路由是特定于节点的 172.20。是kube clusterip服务的地方

172.16.149.0/26  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1
172.16.155.64/26  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1
172.16.176.192/26  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1
172.16.248.128/26  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1
172.20.0.0/16  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1
172.20.88.169  proto bgp  metric 20
        nexthop via 192.168.101.201  dev vlan101 weight 1
        nexthop via 192.168.101.202  dev vlan101 weight 1
        nexthop via 192.168.101.203  dev vlan101 weight 1
        nexthop via 192.168.101.204  dev vlan101 weight 1

Calico BGP清单

---
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
  name: netgate
spec:
  peerIP: 192.168.100.1
  asNumber: 65534

1 个答案:

答案 0 :(得分:0)

如果连接是EBGP(不同的AS),则默认情况下,通过EBGP邻居接收的任何路由都将发送到所有EBGP邻居。您无需在BGP中发布它,因为它已经在BGP表中。要更改此设置,您应该在每个节点仅允许节点网络的地方设置出站过滤器。 即使您不放它,它也不会造成任何直接的问题,因为其他路线会更长,但这是避免将来出现任何奇怪问题的最佳实践。