- 选择2-3个节点充当 route reflector节点(做相互同步备份,防止单点故障)
- 驱逐route reflector节点上的服务实例(防止服务实例)
- 为route reflecor设置routeReflectorClusterID,通常为不用的ipv4的地址,只是个标识,eg:244.0.0.1
calicoctl patch node 192.168.0.1 -p '{"spec": {"bgp": {"routeReflectorClusterID": "244.0.0.1"}}}'
calicoctl patch node 192.168.0.2 -p '{"spec": {"bgp": {"routeReflectorClusterID": "244.0.0.2"}}}' - 为 route reflector 节点打标签,用于route reflector节点发现,并交换路由信息
kubectl label node 192.168.0.1 route-reflector=true
kubectl label node 192.168.0.2 route-reflector=true - 建立route reflector 节点的发现互联
kind: BGPPeer
apiVersion: projectcalico.org/v3
metadata:
name: peer-with-route-reflectors
spec:
nodeSelector: all()
peerSelector: route-reflector == 'true' - 检查route reflector建联状态,当链接状态为Established时,开始下面的操作
- 禁用node-to-node mesh模式
calicoctl patch bgpconfiguration default -p '{"spec": {"nodeToNodeMeshEnabled": false}}'
结论:整个过程,经过pod间ping测试,没有失败情况