Cilium BGP Lab with LoadBalancing and more!

 

At this point, we know how to install Cilium and create a BGP peering with our routers. Now we need to let the outside world reach our Kubernetes apps.

If you don’t have the KinD cluster with Cilium go to https://arielantigua.com/weblog/2024/07/cilium-bgp-lab-locally/

When using Cilium you can reach an application using the Pod IP address or using a LoadBalance IP assigned to a Service. In the previous article we only advertised the Pod Address to our BGP neighbors, lets add more stuff so we can be close to a real deployment.

If you already have cloned the repo, go and do a pull so you can get the new config files and other stuff in the Makefile, or better yet, go and do a new clone of the repo and start from scratch, that’s the idea of the repo!

New stuff in this LAB.

      • serviceSubnet in cluster.yaml (10.2.0.0/16)
      • serviceSelector in the CiliumBGPPeeringPolicy (service = public), this useful to identify what LoadBalancer will be announced by this peering policy.
      • public-pool.yaml with the configuration for the LoadBalancer IP Pool.
      • If you look at the topo.yaml file, will find a new Linux node (client0) for testing, this is based on alpine:latest, will test reachability to our LoadBalancer IP from this container that is connected to tor1 with IP address 10.0.100.2/24
      • Bookinfo application so we can have something to reach from client0.

Now let’s build the environment, just like before, running make will create a KinD cluster with 4 nodes (1 control-plane and 3 workers), a containerlab topology with 3 routers (FRR), and 1 client (Alpine). decide to let alone the Cilium install manually or with make cilium, in case there is a need to do something different with the same KinD cluster or add another option to Cilium at install time.

A black screen with white text Description automatically generated

This is the result of running make, as you can see in the image, now you can go and install Cilium in whatever way you like the most, in this case, I will use these options:

cilium install --version=1.15 \
--helm-set ipam.mode=kubernetes \
--helm-set tunnel-protocol=vxlan \
--helm-set ipv4NativeRoutingCIDR="10.0.0.0/8" \
--helm-set bgpControlPlane.enabled=true \
--helm-set k8s.requireIPv4PodCIDR=true

The fastest way is to do this: make cilium

A screen shot of a computer Description automatically generated

A screen shot of a computer screen Description automatically generated

The nodes are ready for workloads.

Now is the time to apply both, the CiliumBGPPeeringPolicy and the CiliumLoadBalancerIPPool.

You can do it with make or the official way with kubectl.

kubectl apply -f cilium-bgp-peering-policies.yaml 

kubectl apply -f public-pool.yaml

A screen shot of a computer screen Description automatically generated

You can validate the configurations with the following commands.

kubectl get -f cilium-bgp-peering-policies.yaml -oyaml

kubectl get -f public-pool.yaml -oyaml

Our lab environment is ready to assign IP to LoadBalancer services, lest check the existing ones first.

Is time to deploy our test application.

Now there is an app in the repo, you can deploy the bookinfo application, which is used by Istio to do some demos, I just cloned it and added a Service to pick up an Address from our IP Pool and advertised it to the Tor(0,1) routers.

https://github.com/aredan/ciliumlabs/tree/main/bookinfo/kustomize

kubectl apply -k kustomize

A screenshot of a computer program Description automatically generated

Let’s check the Services that we have now.

A screen shot of a computer Description automatically generated

There is our LoadBalancer IP address (10.0.10.1) and others ClusterIP, the LoadBalancer is the one that we will be testing from client0.

A screenshot of a computer program Description automatically generated

We can see there is an IP assigned to the Service, but is better if we can validate that this address is being announced to the Tor routers.

docker exec -it clab-bgp-cplane-router0 vtysh -c 'show bgp ipv4'

A computer screen shot of a computer Description automatically generated

Also, from Cilium itself we can validate that his address is being announced from the virtualRouters.

Within the Cilium CLI exists a subcommand called bgp (hard to pass!!) and with this, we can validate a few things.

A screenshot of a computer Description automatically generated

A screen shot of a computer Description automatically generated

cilium bgp routes advertised ipv4 unicast

A black screen with white text Description automatically generated

Our four nodes are announcing the same address to upstream routers, this is because of the trafficPolicy assigned to the service.

Is time to reach our App.

We need to get into client0 container, this is an alpine container so ash is the shell.

Installing curl and Lynx. In case you don’t know what Lynx is, is a console browser, this feels like traveling to the past when the one that stayed more in the console was the strongest.

A black screen with white text Description automatically generated

A screenshot of a computer program Description automatically generated

A computer screen shot of a black screen Description automatically generated

We can see that curl is reaching the app, this way is hard to interact we the application, now with Lynx!

lynx http://10.0.10.1

A screenshot of a computer Description automatically generated

 

Isovalent (Cilium creators) announced new support for ClusterIP in BGP !!

Cilium BGP Lab, locally!

Maybe you already know about Cilium, You don’t?
Go read https://docs.cilium.io/en/stable/overview/intro/ and come back !!

Hello again!
So now you want to learn about Cilium BGP functionality, for me this is one of the most exciting features of Cilium, maybe the reason is the addiction that I already have for BGP, who knows (AS207036). Back to the point, with Cilium you can establish a BGP session with your routers (Tor, border, or core, you decide.) and announce PodCIDR or LoadBalance for services.

For this learning exercise, we will use Kind and other tools to run a K8s cluster locally on any Linux (Windows or MacOS) machine. There is a lot of info on the internet on how to get Kind up and running and even how to install Cilium, I decided to build a collection of Cilium Labs (ciliumlabs) to speed up the process of getting a Cilium testing environment up and running.

First, go and clone the repo, all the information is on the README of each lab type, in this case, bgp/README.md is the one with the steps to get this ready, but we first need to install the prereqs. The prerequisites are listed in the main README file. In my environment, all this is met so I can proceed with the lab creation.

Continuar leyendo «Cilium BGP Lab, locally!»

pathvector – herramienta para configurar BIRD!

pathvector – herramienta para configurar BIRD!

Hace tiempo que estoy usando BIRD para convertir esos servidores Linux en routers con BGP/OSPF y tener enrutamiento dinámico. Uno de los obstáculos iniciales con BIRD era la sintaxis, muy diferente a Cisco y a Quagga (Ahora FRR), sentirme a gusto me tomo tiempo, pero se logro.

De ese cambio ya hace mucho tiempo, el segundo paso luego de usar BIRD es lo fácil que se puede automatizar su configuración, algo que hice en los primeros días era tener los archivos de configuración en Git para así poder versionarlos, luego usaba un contenedor Docker el cual generaba las configuraciones finales, lamentablemente cada herramienta o metodología tenia sus propios problemas y terminaba haciendo configuraciones manuales fuera de la herramienta que intentaba adoptar.

Continuar leyendo «pathvector – herramienta para configurar BIRD!»

NxCloud – Filtro de contenido a nivel DNS.

NxCloud – Filtro de contenido a nivel DNS.

Desde hace mucho tiempo he trabajado en áreas que tienen que ver con los controles, en este caso el control de la navegación web.

Existen muchas herramientas OpenSource que sirven para tener esta funcionalidad en una red del hogar. En mi caso la herramienta que uso desde hace varios años es una versión de NxFilter para la nube, que significa disponibilidad para varias redes/personas/identidades.

Inicialmente siempre realizaba la instalación en un servidor en Ubuntu, luego inicie con el tema de los contenedores y al final mi instalación está corriendo en Kubernetes.

Para la versión Cloud (NxCloud) he creado un contenedor que esta en DockerHub y es accesible para todos, esa es la idea de los contenedores en DockerHub. Doh!

Continuar leyendo «NxCloud – Filtro de contenido a nivel DNS.»

Seguridad de Enrutamiento, como estamos y como debemos estar.

Nota: Esto es un post que esta publicado en el portal de ISCO-Dominicana, he decidido publicarlo aqui tambien y asi poder relacionarlo con otros proyectos que tengo en lista.

Seguridad de Enrutamiento, como estamos y como debemos estar.

Cada día la infraestructura de Internet es atacada de formas que no imaginamos, en los últimos años hemos visto como personas y/o organizaciones buscan la manera de lucrarse aprovechando las debilidades en la infraestructura de Internet ya sea apoderándose de recursos o haciendo que estos recursos no estén disponibles para los usuarios.

Muchos sabemos el origen de Internet, en sus primeros años nadie imagino que esta plataforma seria lo que es hoy y por esto, muchos de los protocolos que son pilares de Internet no cuentan con la seguridad necesaria para prevenir que un atacante pueda causar daños a la infraestructura que lo forma. Aunque en sus inicios estos protocolos no tenían esa seguridad que deseamos no quiere decir que no se han creado las medidas para protegerlos.

Continuar leyendo «Seguridad de Enrutamiento, como estamos y como debemos estar.»