Advertising Kubernetes service addresses with Cilium
The public addresses I use at Hetzner need a route to the services running in Zebra, my Kubernetes cluster. Giving a Kubernetes Service an address is only part of that job. The routers carrying traffic towards it also need to know where to send the packets.
Cilium provides networking for the cluster. Border Gateway Protocol (BGP) exchanges information about reachable network addresses between peers. I use Cilium's BGP control plane to advertise selected LoadBalancer addresses to my home router. That connects Kubernetes service addressing with the routing setup outside the cluster, so the two do not need to be maintained as unrelated lists.
The CHR arrangement at Hetzner explains why I want those public addresses in the first place. CHR is a virtual MikroTik router at Hetzner, joined to my home router through a WireGuard encrypted tunnel. Hetzner delivers the public traffic to CHR; I need the routers to carry it onwards to Kubernetes.
Selecting an address to advertise
Cilium's LoadBalancer IP address management allocates addresses from configured pools to matching Services. The public pool contains the Hetzner floating addresses used by the ingress services. These addresses come from Hetzner; Cilium allocates them within the cluster configuration rather than creating a public allocation of its own.
A Kubernetes Service gives an application a stable network endpoint; a LoadBalancer Service can receive an externally reachable address. A separate Cilium advertisement selects labelled Services and announces their LoadBalancer addresses.
This sanitised fragment shows the selection in a CiliumBGPAdvertisement resource:
spec:
advertisements:
- advertisementType: Service
service:
addresses: [LoadBalancerIP]
selector:
matchLabels:
routing.example.com/advertise: public
The matching label belongs on the Service. This fragment does not create a public IP pool or a BGP peer: both must already be configured, and the peer configuration must select this advertisement. The upstream service-advertisement documentation covers those surrounding resources. Keeping that selection explicit means an ordinary application does not automatically become a public BGP advertisement simply because it exists in Kubernetes.
Getting the route to CHR
The selected home nodes peer with the home router using internal BGP (iBGP), meaning they exchange routes within the same routing system. The home router acts as a route reflector, passing learned routes to other peers, and passes the service routes towards CHR with the next hop adjusted for that path.
In outline, the route information travels like this:
Cilium on home nodes -> home router -> CHR at Hetzner
Traffic for those public endpoints comes in the other direction:
Client -> Hetzner floating IP -> CHR
|
tunnel
|
home router -> Kubernetes service
This is routing between my own nodes and routers. I am not announcing a privately owned prefix to the global internet. Hetzner still handles delivery of its assigned addresses to CHR.
Cilium's BGP documentation separates route advertisement from the datapath that forwards traffic. That distinction matters here: an established BGP session is useful evidence, but I still need to test that the advertised route is installed and that a request reaches the application with a working return path.
Keeping changes contained
The configuration uses selectors and router-side filters to constrain the routes involved. Those boundaries deserve review whenever I add a pool or expose another Service. A route tells a router how to reach an address; firewall rules and application permissions still determine what access should be allowed.
The security boundaries need to be checked separately: selecting a service route does not enforce user permissions or isolate a compromised workload. Nor does another advertised path create a copy of data outside the home room.
There are also different failure cases. Losing a node can change the available advertised paths. Losing fibre changes the tunnel's transport and may leave BGP intact or require it to recover, depending on timing. The configured timers alone do not prove the user-visible interruption for either case.
The useful test is a request from outside the setup while a controlled change happens, observing the service address, routing state, and application response. I would keep that as a separate walkthrough rather than imply that this design has proved a seamless failover.
When this needs debugging, I can follow it in order: did the Service get the right address, did that route reach the routers, and can a request get there and back? Cilium joins those pieces up without making me maintain a route for every application. I still need to check the traffic, but at least I know where to start.