This Ansible playbook sets up network tunnels and multi-cluster connectivity using VXLAN tunnels, BIRD BGP routing, and Calico integration.
- VXLAN Tunnels: Virtual Extensible LAN tunnels for Layer 2 connectivity across networks
- BGP Routing: BIRD-based dynamic routing with support for ECMP and path isolation
- Multi-Cluster Kubernetes: Calico integration for cross-cluster pod and service connectivity
- Dynamic Interface Configuration: Support for any interface naming convention (eth0, ens3, etc.)
- Comprehensive Network Tuning: Extensive sysctl configuration for optimal performance
- ECMP Support: Equal-cost multipath routing for load balancing
The playbook consists of three main components:
- VXLAN Role: Creates VXLAN tunnels between virtual machines
- BIRD Role: Configures BGP routing for dynamic route propagation
- Calico Role: Integrates Kubernetes clusters via BGP peering
Each host in a VXLAN tunnel group requires:
all:
hosts:
machine1:
ansible_host: your-server-ip
tunnel_type: src
public_ip: your-public-ip
physical_interfaces:
- name: eth0
ip: 192.168.1.10/24
engine1:
ansible_host: peer-server-ip
tunnel_type: dest
public_ip: peer-public-ip
physical_interfaces:
- name: ens3
ip: 10.0.0.5/24
children:
vxlan_all:
hosts:
machine1:
engine1:In group_vars/all/tunnel.yaml:
# VXLAN configuration
vxlan_ip_range: 192.168.234
vxlan_cidr: 24
# ECMP and BGP settings
enable_ecmp: true
enable_path_isolation: true- Configure your inventory in
inventory/your-environment/hosts.yml - Update global variables in
group_vars/all/tunnel.yamlandgroup_vars/all/kube.yaml - Run the playbook:
# Deploy everything
ansible-playbook -i inventory/your-environment/hosts.yml site.yml
# Deploy only VXLAN tunnels
ansible-playbook -i inventory/your-environment/hosts.yml site.yml --tags vxlan
# Deploy only BIRD BGP
ansible-playbook -i inventory/your-environment/hosts.yml site.yml --tags bird
# Deploy only Calico configuration
ansible-playbook -i inventory/your-environment/hosts.yml site.yml --tags calicoCreates VXLAN tunnels with comprehensive sysctl tuning for optimal performance. See roles/vxlan/README.md for details.
Configures BGP routing with support for ECMP and path isolation. See roles/bird/README.md for details.
Integrates Kubernetes clusters via BGP peering. See roles/calico/README.md for details.
# View tunnel configuration
ip tunnel show
# Check VXLAN interface
ip addr show vxlan-eth0
# Test connectivity
ping 192.168.234.2 # Replace with peer tunnel IP# View BGP protocols
sudo birdc show protocols
# View BGP routes
sudo birdc show route# Check BGP peers
calicoctl node status
# View routes
calicoctl get bgp routes# VXLAN/netplan logs
journalctl -u networking
# BIRD logs
journalctl -u bird
# Calico logs (on Kubernetes nodes)
kubectl logs -n kube-system -l k8s-app=calico-nodeFor detailed documentation on each role:
- VXLAN Role - VXLAN tunnel configuration
- BIRD Role - BGP routing configuration
- Calico Role - Kubernetes multi-cluster integration
- ECMP Role - ECMP routing support
- Workers ECMP Role - ECMP on Kubernetes workers
- Dynamic Route Role - Dynamic routing for clients
- Metrics Role - Tunnel monitoring