Implement BGP #156
sebiklamar
started this conversation in
Ideas
Replies: 1 comment
-
|
@sebiklamar Thanks for the info! This is a goldmine once I start testing it out. I've been way too busy these last months, but I think I'll be able to look at BGP with Cilium and UniFi soon™ Other resources I have for this are |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Vegard,
as I saw you having BGP support on your roadmap list, I want to share my documentation and experience of my BGP w/ Opnsense including
EgressGatewayPoC.What's in the pocket
Ingress(IngressGateway) with any IP you want, i.e. you don't need to have a matching interface for that. Just name an IP to your liking in theio.cilium/lb-ipam-ipsannotation as usually and cilium will add it to the BGP routing.L2routing/reachability of your BGP-managed IPs because your default gateway will do a RA for your hosts still residing in the same L2 net (your192.168.1.0/24subnet), i.e. you can switch of yourL2Announcementcode. I didn't further investigate this b/c this is not a relevant scenario in my environment (k8s nodes in a separate server VLAN).Egress(EgressGateway) with BGP iff you have anIngressdefined in parallel. Due to the limitation mentioned in the next (4.) item there's no BGP advertisement for theEgress. Hence, you need to define anIngressin parallel (counter-measure 1) and you need to ensure theEgressis set up for the same node as the pod using theIngressis running (counter-measure 2) , i.e. you will need to pin (nodeSelector) both theDeploymentand theCiliumEgressGatewayPolicy.NB: For
Ingress-only scenario (1.) no pinning is needed at all, i.e. you will have full flexibility.Egress-only scenario (without anyIngressfor the same IP). Would need Cilium Enterprise Ed., cf. Cilium blog post for Cilium Enterprise 1.15.EgressGatewayfeature, you would need to live withoutCiliumEndpointSlicefeature (cf. cilium issue 24833).CiliumEndpointSliceis currently enabled in your environment.How-to
TLDR
For seeing all pieces in action see in my evolving homelab repo based on your setup
opensshapp forEgressGateway(andIngressGateway) example.additional-values.yamlfile for cilium installation, cf. details below.baseandenvs/devfolders contain the Resource definitions for BGPLinks
BGPPeeringPolicy), though good opnsense docu: https://baremetalblog.com/posts/tech/2024-03-12-cilium-bgp-and-you/EgressGateway: https://docs.cilium.io/en/stable/network/egress-gateway/egress-gateway/opnsense guide
See the 3rd link listed above which is having good screenshot documentation on opnsense setup.
My documented install notes from Obsidian:
os-frrpackage (from Plugins tab)tcp/179on interfaceK8SWarning message during install
Configuration
Routing > General
Routing > BGP
General
Neigbours
k8s guide
Ensure BGP is enabled in cilium
For also having
Egressfeature available, ciliumvalues.yamlfile needs to be at least:FYI: I currently maintain a base
values.yamland an env.-specificadditional-values.yamlfile. Though, I didn't manage yet to maintain thevalues.yamlfile only once in thebasefolder with only patches being applied in the environments as overlay.Resource Definitions
Overview
base/CiliumBGPAdvertisements: Defines prefixes that are injected into the BGP routing table.base/CiliumBGPPeerConfig: A common set of BGP peering setting. It can be used across multiple peers.<env>/CiliumBGPClusterConfig: Defines BGP instances and peer configurations that are applied to multiple nodes, specific to an<environment>.CiliumBGPNodeConfigOverride: Defines node-specific BGP configuration to provide a finer control, not used.<env>/CiliumBGPClusterConfigenvironment-specific
ASNs
Just pick an ASN ID from the private AS number range 64.512 – 65.534 (16b) or from the newer 32b range 4.200.000.000 - 4.294.967.294.
Most documented setups (incl. mine at the moment) use different ASNs for the router (e.g. opnsense) and partner (k8s cluster), although, AFAIK, the same ASNs can be used (it's the same party/system "Vegard's system/environment").
Cheat Sheet
Have fun with a modern routing setup with certainly more robust connectivity (instead of the
k8sClientRateLimithack for L2), and true source IP.HTH -- Sebastian
Edit: Added cilium folders links in TLDR section as openssh only covers Egress and not BGP and links.
Beta Was this translation helpful? Give feedback.
All reactions