【kubernetes/k8s概念】calico node bird原理分析

github: https://github.com/projectcalico/bird

BIRD是什么

      BIRD是布拉格查理大学数学与物理学院的一个学校项目,项目名是BIRD Internet Routing Daemon的缩写。 目前,它由CZ.NIC实验室开发和支持。

     BIRD项目旨在开发一个功能齐全的动态 IP 路由守护进程,主要针对(但不限于)Linux,FreeBSD和其他类UNIX系统,并在GNU通用公共许可证下分发。详细信息参照官网 https://bird.network.cz

    calico 中的 Bird是一个BGP client,它会主动读取felix在host上设置的路由信息,然后通过BGP协议广播出去

support

  o Both IPv4 and IPv6 (use --enable-ipv6 when configuring)
  o Multiple routing tables
  o Border Gateway Protocol (BGPv4)
  o Routing Information Protocol (RIPv2, RIPng)
  o Open Shortest Path First protocol (OSPFv2, OSPFv3)
  o Babel Routing Protocol (Babel)
  o Bidirectional Forwarding Detection (BFD)
  o IPv6 router advertisements
  o Static routes
  o Inter-table protocol
  o Command-line interface allowing on-line control and inspection of status of the daemon
  o Soft reconfiguration, no need to use complex online commands to
change the configuration, just edit the configuration file and notify
BIRD to re-read it and it will smoothly switch itself to the new
configuration, not disturbing routing protocols unless they are
affected by the configuration changes
 
  o Powerful language for route filtering, see doc/bird.conf.example
  o Linux, FreeBSD, NetBSD and OpenBSD ports

1. BGP Client (BIRD)

    Calico在每个运行Felix服务的节点上都部署一个BGP客户端。 BGP客户端的作用是读取Felix程序写到内核中并在数据中心内分发的路由信息

   BGP客户端负责执行以下任务:

  • 路由信息分发,当Felix将路由插入Linux内核FIB时,BGP客户端将接收它们并将它们分发到集群中的其他工作节点

2. BGP Route Reflector (BIRD)

     在较大规模的部署中,Calico建议部署BGP Route Reflector。通常是在Internet中使用这BGP客户端连接的中心点,从而防止它们需要与群集中的每个BGP客户端进行通信。为了实现冗余,也可以同时部署多个BGP Route Reflector服务。Route Reflector仅仅是协助管理BGP网络,并没有endpoint数据会通过它们。

       在Calico中,此BGP组件也是使用的最常见的BIRD,配置为Route Reflector运行,而不是标准BGP客户端。

BGP Route Reflector负责以下任务:

  • 集中式的路由信息分发,当Calico BGP客户端将路由从其FIB通告到Route Reflector时,Route Reflector会将这些路由通告给部署集群中的其他节点。

birdctl 是 bird 的 client,可以用来查看 bird 的状态

 # birdcl -s /var/run/calico/bird.ctl show protocols
BIRD v0.3.3+birdv1.6.3 ready.
name     proto    table    state  since       info
static1  Static   master   up     00:47:28    
kernel1  Kernel   master   up     00:47:28    
device1  Device   master   up     00:47:28    
direct1  Direct   master   up     00:47:28

查看所有的路由 

# birdcl -s /var/run/calico/bird.ctl show route    
BIRD v0.3.3+birdv1.6.3 ready.
0.0.0.0/0          via 192.168.72.1 on enp0s3 [kernel1 00:47:28] * (10)
192.170.77.137/32  dev calif4ae9085e4a [kernel1 00:47:28] * (10)
192.170.77.136/32  dev cali878322207c2 [kernel1 00:47:28] * (10)
192.170.77.139/32  dev cali8bbfee2ad9e [kernel1 00:47:28] * (10)
192.170.77.138/32  dev cali691e7cb552c [kernel1 00:47:28] * (10)
192.170.77.128/26  blackhole [static1 00:47:28] * (200)
192.170.77.192/26  blackhole [static1 00:47:28] * (200)
192.168.72.0/22    dev enp0s3 [direct1 00:47:28] * (240)
192.170.80.0/24    dev docker0 [direct1 00:47:28] * (240)
192.170.77.135/32  dev calie01333a0edc [kernel1 00:47:28] * (10)

参考:

   https://bird.network.cz/  

   https://bird.network.cz/?get_doc&f=bird-4.html

发布了236 篇原创文章 · 获赞 301 · 访问量 38万+

猜你喜欢

转载自blog.csdn.net/zhonglinzhang/article/details/97626768
今日推荐