Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

BGP

https://docs.cilium.io/en/stable/network/bgp-control-plane/bgp-control-plane/

  • In addition to native and tunnel routing modes, Cilium also supports advertising routing via BGP

Enable BGP

bgpControlPlane:
  # -- Enables the BGP control plane.
  enabled: false

After enabling BPG, you need to create a CiliumBGPClusterConfig. CiliumBGPClusterConfig resource is used to define BGP configuration for one or more nodes in the cluster based on its nodeSelector field. Each CiliumBGPClusterConfig defines one or more BGP instances, which are uniquely identified by their name field.

apiVersion: cilium.io/v2
kind: CiliumBGPClusterConfig
metadata:
  name: cilium-bgp
spec:
  nodeSelector:
    matchLabels:
      rack: rack0
  bgpInstances:
  - name: "instance-65000"
    localASN: 65000
    localPort: 179
    peers:
    - name: "peer-65000-tor1"
      peerASN: 65000
      peerAddress: fd00:10:0:0::1
      peerConfigRef:
        name: "cilium-peer"
    - name: "peer-65000-tor2"
      peerASN: 65000
      peerAddress: fd00:11:0:0::1
      peerConfigRef:
        name: "cilium-peer"

You can also create a BGP advertisement:

apiVersion: cilium.io/v2
kind: CiliumBGPAdvertisement
metadata:
  name: bgp-advertisements
  labels:
    advertise: bgp
spec:
  advertisements:
    - advertisementType: "PodCIDR"
      attributes:
        communities:
          standard: [ "65000:99" ]
        localPreference: 99

Useful commands

λ ~ $ cilium bgp  routes
(Defaulting to `available ipv4 unicast` routes, please see help for more options)


Error: Unable to get BGP routes: failed to unmarshal bgp routes from cilium-7r5vj: invalid character 'B' looking for beginning of value
failed to unmarshal bgp routes from cilium-plrgs: invalid character 'B' looking for beginning of value
failed to unmarshal bgp routes from cilium-c5xmm: invalid character 'B' looking for beginning of value
λ ~ $ cilium bgp peers

Error: Unable to get peering status: failed to unmarshal bgp state from cilium-plrgs: invalid character 'B' looking for beginning of value
failed to unmarshal bgp state from cilium-7r5vj: invalid character 'B' looking for beginning of value
failed to unmarshal bgp state from cilium-c5xmm: invalid character 'B' looking for beginning of value
λ ~ $