Help improve this page
To contribute to this user guide, choose the Edit this page on GitHub link that is located in the right pane of every page.
Configure Cilium BGP for hybrid nodes
This topic describes how to configure Cilium Border Gateway Protocol (BGP) for Amazon EKS Hybrid Nodes. Cilium’s BGP functionality is called Cilium BGP Control Plane
Configure Cilium BGP
Prerequisites
-
Cilium installed following the instructions in Configure CNI for hybrid nodes.
Procedure
-
To use BGP with Cilium to advertise pod or service addresses with your on-premises network, Cilium must be installed with
bgpControlPlane.enabled: true. If you are enabling BGP for an existing Cilium deployment, you must restart the Cilium operator to apply the BGP configuration if BGP was not previously enabled. You can setoperator.rollOutPodstotruein your Helm values to restart the Cilium operator as part of the Helm install/upgrade process.helm upgrade cilium oci://public.ecr.aws/eks/cilium/cilium \ --namespace kube-system \ --reuse-values \ --set operator.rollOutPods=true \ --set bgpControlPlane.enabled=true -
Confirm that the Cilium operator and agents were restarted and are running.
kubectl -n kube-system get pods --selector=app.kubernetes.io/part-of=ciliumNAME READY STATUS RESTARTS AGE cilium-grwlc 1/1 Running 0 4m12s cilium-operator-68f7766967-5nnbl 1/1 Running 0 4m20s cilium-operator-68f7766967-7spfz 1/1 Running 0 4m20s cilium-pnxcv 1/1 Running 0 6m29s cilium-r7qkj 1/1 Running 0 4m12s cilium-wxhfn 1/1 Running 0 4m1s cilium-z7hlb 1/1 Running 0 6m30s -
Create a file called
cilium-bgp-cluster.yamlwith aCiliumBGPClusterConfigdefinition. You may need to obtain the following information from your network administrator.-
Configure
localASNwith the ASN for the nodes running Cilium. -
Configure
peerASNwith the ASN for your on-premises router. -
Configure the
peerAddresswith the on-premises router IP that each node running Cilium will peer with.apiVersion: cilium.io/v2alpha1 kind: CiliumBGPClusterConfig metadata: name: cilium-bgp spec: nodeSelector: matchExpressions: - key: eks.amazonaws.com/compute-type operator: In values: - hybrid bgpInstances: - name: "rack0" localASN:NODES_ASNpeers: - name: "onprem-router" peerASN:ONPREM_ROUTER_ASNpeerAddress:ONPREM_ROUTER_IPpeerConfigRef: name: "cilium-peer"
-
-
Apply the Cilium BGP cluster configuration to your cluster.
kubectl apply -f cilium-bgp-cluster.yaml -
Create a file named
cilium-bgp-peer.yamlwith theCiliumBGPPeerConfigresource that defines a BGP peer configuration. Multiple peers can share the same configuration and provide reference to the commonCiliumBGPPeerConfigresource. See the BGP Peer configurationin the Cilium documentation for a full list of configuration options. The values for the following Cilium peer settings must match those of the on-premises router you are peering with.
-
Configure
holdTimeSecondswhich determines how long a BGP peer waits for a keepalive or update message before declaring the session down. The default is 90 seconds. -
Configure
keepAliveTimeSecondswhich determines if a BGP peer is still reachable and the BGP session is active. The default is 30 seconds. -
Configure
restartTimeSecondswhich determines the time that Cilium’s BGP control plane is expected to re-establish the BGP session after a restart. The default is 120 seconds.apiVersion: cilium.io/v2alpha1 kind: CiliumBGPPeerConfig metadata: name: cilium-peer spec: timers: holdTimeSeconds:90keepAliveTimeSeconds:30gracefulRestart: enabled: true restartTimeSeconds:120families: - afi: ipv4 safi: unicast advertisements: matchLabels: advertise: "bgp"
-
-
Apply the Cilium BGP peer configuration to your cluster.
kubectl apply -f cilium-bgp-peer.yaml -
Create a file named
cilium-bgp-advertisement-pods.yamlwith aCiliumBGPAdvertisementresource to advertise the pod CIDRs to your on-premises network.-
The
CiliumBGPAdvertisementresource is used to define advertisement types and attributes associated with them. The example below configures Cilium to advertise only pod CIDRs. See the examples in Service type LoadBalancer and Cilium in-cluster load balancing for more information on configuring Cilium to advertise service addresses. -
Each hybrid node running the Cilium agent peers with the upstream BGP-enabled router. Each node advertises the pod CIDR range that it owns when Cilium’s
advertisementTypeis set toPodCIDRlike in the example below. See the BGP Advertisements configurationin the Cilium documentation for more information. apiVersion: cilium.io/v2alpha1 kind: CiliumBGPAdvertisement metadata: name: bgp-advertisement-pods labels: advertise: bgp spec: advertisements: - advertisementType: "PodCIDR"
-
-
Apply the Cilium BGP Advertisement configuration to your cluster.
kubectl apply -f cilium-bgp-advertisement-pods.yaml -
You can confirm the BGP peering worked with the Cilium CLI
by using the cilium bgp peerscommand. You should see the correct values in the output for your environment and the Session State asestablished. See the Troubleshooting and Operations Guidein the Cilium documentation for more information on troubleshooting. In the examples below, there are five hybrid nodes running the Cilium agent and each node is advertising the Pod CIDR range that it owns.
cilium bgp peersNode Local AS Peer AS Peer Address Session State Uptime Family Received Advertised mi-026d6a261e355fba7NODES_ASNONPREM_ROUTER_ASNONPREM_ROUTER_IPestablished 1h18m58s ipv4/unicast 1 2 mi-082f73826a163626eNODES_ASNONPREM_ROUTER_ASNONPREM_ROUTER_IPestablished 1h19m12s ipv4/unicast 1 2 mi-09183e8a3d755abf6NODES_ASNONPREM_ROUTER_ASNONPREM_ROUTER_IPestablished 1h18m47s ipv4/unicast 1 2 mi-0d78d815980ed202dNODES_ASNONPREM_ROUTER_ASNONPREM_ROUTER_IPestablished 1h19m12s ipv4/unicast 1 2 mi-0daa253999fe92daaNODES_ASNONPREM_ROUTER_ASNONPREM_ROUTER_IPestablished 1h18m58s ipv4/unicast 1 2cilium bgp routesNode VRouter Prefix NextHop Age Attrs mi-026d6a261e355fba7NODES_ASN10.86.2.0/26 0.0.0.0 1h16m46s [{Origin: i} {Nexthop: 0.0.0.0}] mi-082f73826a163626eNODES_ASN10.86.2.192/26 0.0.0.0 1h16m46s [{Origin: i} {Nexthop: 0.0.0.0}] mi-09183e8a3d755abf6NODES_ASN10.86.2.64/26 0.0.0.0 1h16m46s [{Origin: i} {Nexthop: 0.0.0.0}] mi-0d78d815980ed202dNODES_ASN10.86.2.128/26 0.0.0.0 1h16m46s [{Origin: i} {Nexthop: 0.0.0.0}] mi-0daa253999fe92daaNODES_ASN10.86.3.0/26 0.0.0.0 1h16m46s [{Origin: i} {Nexthop: 0.0.0.0}]