Calico官网提供了两种网络设计模式:
AS per rack
: 每个rack(机架)组成一个AS,每个rack的TOR交换机与核心交换机组成一个ASAS per server
: 每个node做为一个AS,TOR交换机组成一个transit AS每个TOR分为四个交换机,每个node与每个交换机都有连接。通过颜色区分每一个平面。
在Kubernetes平台中,使用calico brid生成的路由条目与endpoint相关,会对路由分配网段,这样可以减少路由条目数量,但不会改变路由数量级。当集群规模过大,endpoints与对应的路由条目也会随之增加,此时就需要可以处理一定量级路由的网络设备。无论使用那种网络模式,始终都会有一个网络设备上要存放calico网络拓扑中的所有路由。所以在使用calico网络时,需要确定网络处理能力,此时使用单独node或master代替bgp反射器不是很恰当了。
实验完成:
node-to-node mesh
方式建立BGP连接实验目标:将Node的BGP压力转移到了TOR之上。随着rack的增加,还可以使用Spine承担TOR的压力
选择"其他设备" 并添加"Cloud"到eNSP, 并设置对应接口
这里AR1 AR2 为TOR Cloud的对端为vmvare adpter,连接的是多个虚拟机,因为使用交换机相连,从概念上完成了一个简易的AS per rack
。
system-view
sysname SW1
vlan batch 10 20 30
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20 30
system-view
sysname R1
interface GigabitEthernet0/0/0
ip address 10.0.0.253 24
dis this
quit
interface l0
ip address 1.1.1.1 32
quit
ospf router-id 1.1.1.1
area 0
network 1.1.1.1 0.0.0.0
network 10.0.0.253 0.0.0.0
dis this
system-view
sysname R2
interface GigabitEthernet0/0/0
ip address 10.0.0.254 24
dis this
quit
interface l0
ip address 2.2.2.2 32
quit
ospf router-id 2.2.2.2
area 0
network 2.2.2.2 0.0.0.0
network 10.0.0.254 0.0.0.0
dis this
bgp 64512
router-id 10.0.0.253
peer 10.0.0.254 as-number 63400
bgp 63400
router-id 10.0.0.254
peer 10.0.0.253 as-number 64512
bgp 64512
router-id 10.0.0.253
peer 10.0.0.5 as-number 64512
peer 10.0.0.5 reflect-client
dis ip interface brief
bgp 63400
router-id 10.0.0.254
peer 10.0.0.6 as-number 63400
peer 10.0.0.6 reflect-client
dis ip interface brief
配置calico bgp rr需要用到 BGPConfiguration
BGPPeer
Node
对应的资源清单的配置
配置全局asNumber
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
name: default
spec:
logSeverityScreen: Info
nodeToNodeMeshEnabled: false
asNumber: 64512
配置bgp peer
注意bgp对等体作用域范围,也可以理解为使用
node specific
: 生效与特定节点
globe
: 全局配置,使用该配置时不能配置node
和nodeSelector
字段,这个配置将集群中所有的节点都建立bgp关系
node-to-node mesh
:全互联模式
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: default-64512
spec:
node: master01 # 指定bgppeer生效范围,默认为全局模式
peerIP: 10.0.0.253 # bgp对等体的IP
asNumber: 64512
---
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: default-63400
spec:
node: node02
peerIP: 10.0.0.254
asNumber: 63400
此时可以看到node与tor间形成了对应的bgp rr
[root@node02 ~]# calicoctl node status
Calico process is running.
IPv4 BGP status
+--------------+---------------+-------+----------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+--------------+---------------+-------+----------+-------------+
| 10.0.0.254 | node specific | up | 14:34:30 | Established |
+--------------+---------------+-------+----------+-------------+
[root@master01 ~]# calicoctl node status
Calico process is running.
IPv4 BGP status
+--------------+---------------+-------+----------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+--------------+---------------+-------+----------+-------------+
| 10.0.0.253 | node specific | up | 01:29:08 | Established |
+--------------+---------------+-------+----------+-------------
对应的tor中也学习到相应的pod间的路由条目,而TOR只与自己建立bgp rr的node的路由进行学习,其他Node的Pod间路由,由tor之间的EBGP进行学习到的。
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 OSPF 10 1 D 10.0.0.254 GigabitEthernet0/0/0
10.0.0.0/24 Direct 0 0 D 10.0.0.253 GigabitEthernet0/0/0
10.0.0.253/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.0.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.244.140.64/26 EBGP 255 0 D 10.0.0.6 GigabitEthernet0/0/0
10.244.241.64/26 IBGP 255 0 RD 10.0.0.5 GigabitEthernet0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
手机扫一扫
移动阅读更方便
你可能感兴趣的文章