How to run Bird BGP daemon on Kubernetes cluster as Static Pod
2 min readFeb 12, 2021
Kubernetes Bird manifest, bird.yaml
---
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: bird
tier: control-plane
name: bird
namespace: kube-system
spec:
containers:
- image: pierky/bird:1.6.8
imagePullPolicy: IfNotPresent
name: bird
resources: {}
volumeMounts:
- mountPath: /etc/bird
name: bird-config
hostNetwork: true
priorityClassName: system-cluster-critical
volumes:
- hostPath:
path: /etc/bird
type: Directory
name: bird-config
status: {}
Put bird.yaml file into the kubernetes static pod folder
/etc/kubernetes/manifests
Create bird configuration
[admin@sv-sitectl-node01 ~]$mkdir -p /etc/bird/
[admin@sv-sitectl-node01 ~]$ cat /etc/bird/bird.conf
filter my_bgp {
# the IP range(s) to announce via BGP from this machine
# these IP addresses need to be bound to the lo interface
# to be reachable; the default behavior is to accept all
# prefixes bound to interface lo
# if net = A.B.C.D/32 then accept;
accept;
}
router id 10.80.0.49;protocol device {
scan time 10;
}
protocol direct {
interface "lo";
}
protocol bgp metallb {
local as 64610;
neighbor 127.0.0.1 as 64620;
multihop;
passive;
}
protocol bgp upstream_1 {
export filter packet_bgp;
local as 65000;
neighbor 169.254.255.1 as 65301;
multihop 5;
}
protocol bgp upstream_2 {
export filter packet_bgp;
local as 65000;
neighbor 169.254.255.2 as 65301;
multihop 5;
}
In above configuration, we have two upstream BGP session towards TOR switch, and one internal BGP session towards MetalLB which provide Load Balancer service for POD.
Check BGP session state.
[root@sv-sitectl-node01 bird-2.0.7]# birdc show protocol all
BIRD 2.0.7 ready.
Name Proto Table State Since Info
device1 Device --- up 21:07:48.681direct1 Direct --- up 21:07:48.681metallb BGP --- start 21:11:40.474 Idle BGP Error: Required capability missing
BGP state: Idle
Neighbor address: 127.0.0.1
Neighbor AS: 64620
Local AS: 64610
Error wait: 171.069/240
Last error: BGP Error: Required capability missingupstream_1 BGP --- start 21:07:48.681 Active Socket: No route to host
BGP state: Active
Neighbor address: 169.254.255.1
Neighbor AS: 65530
Local AS: 65000
Connect delay: 2.544/5
Last error: Socket: No route to host
Channel ipv4
State: DOWN
Table: master4
Preference: 100
Input filter: ACCEPT
Output filter: packet_bgp
IGP IPv4 table: master4upstream_2 BGP --- start 21:07:48.681 Active Socket: No route to host
BGP state: Active
Neighbor address: 169.254.255.2
Neighbor AS: 65530
Local AS: 65000
Connect delay: 0.927/5
Last error: Socket: No route to host
Channel ipv4
State: DOWN
Table: master4
Preference: 100
Input filter: ACCEPT
Output filter: packet_bgp
IGP IPv4 table: master4